Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing module in gatsby removing some gatsby dependent modules. #24176

Closed
aomini opened this issue May 18, 2020 · 2 comments
Closed

Installing module in gatsby removing some gatsby dependent modules. #24176

aomini opened this issue May 18, 2020 · 2 comments
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@aomini
Copy link

aomini commented May 18, 2020

#issue
My issue is similar to his #6834. I've faced this issue before just a day in a new gatsby project.
When installing a module after a project is set up it deletes some of the gatsby depencies. And I'm unable to run gatsby develop because of missing dependencies.

#solution:
It can be solved by running Npm install again which is definately not ideal.

#Steps to reproduce:

  1. generated a fresh new gatsby site without any template.
gatsby new site
  1. npm i gatsby-plugin-typescript this will remove the depencies.

I don't have the warnings but it was showing something like update core.js 2.3.

@aomini aomini added the type: bug An issue or pull request relating to a bug in Gatsby label May 18, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 18, 2020
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 18, 2020
@LekoArts
Copy link
Contributor

Thank you for opening this!

As mentioned in some other issue (#20225, #19827, #19064) this is due to a bug with npm and its lock files. You probably have yarn installed or chose it as your package manager for the Gatsby CLI hence a gatsby new will delete the package-lock.json file upon installation. This then causes problems if you use npm again.

You can change your default manager if you always want to use npm: https://www.gatsbyjs.org/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project

We'll work on improving this by maybe e.g. not deleting the lock files (as yarn doesn't have problems with this).

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

@jaytommy
Copy link

This is absolutely bonkers! I am a Gatsby newbie and have a similar issue to so many here. I installed the sass plugin (along with node-sass) and the gatsby develop command fails. I've had the cannot find React error. Now I am getting the issue where it cannot interpret my scss file.
image

I deleted lock files and node_modules then ran npm install. Still no luck.
I deleted lock files and node_modules then attempted to install with yarn. Still no luck.

I am willing to start anew, but need some guidance on the most reliable path. Use npm? yarn? Are there certain versions of gatsby, react, react-dom, etc to avoid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants