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
Error: Cannot find module 'react' - after installing Plugin #18048
Comments
Just tested it and the error pops up. But it does not pop up when using yarn. |
but docs all in |
just pointing it out, to provide some more context. |
I am also running into this error |
This might be because npm calculates the deptree differently. Does this also happen with the latest release of npm? |
I also tried it with the latest version of npm without luck. yarn always works fine. But since this is definitely an issue with npm there isn't much we can do about it. Changing our whole documentation (since a lot of pages tell you to install something and then run Hence I'm closing this issue. Thanks for opening it though, hope npm fixes this soon! |
Is there an npm issue filed about this? |
But now the users have this problem. I think we should add a note to the docs (maybe as hint) so that new users don't get confused and not have a bad onboarding experience. If this is fixed by npm we can remove this hint later. |
Ya I started a new gatsby project (around my 4th one, but havent had a new one in months), updated everything and then all shit went to hell. Does anyone know when there will be a npm fix or do we all just have to start using yarn |
I'm having the problem even if I use yarn.
Now I'm getting around by copying another project's files (without node_modules folder), installing the dependencies and modifying it. |
This occurred for me when I added
Seemed to bring it back to life. The docs mention |
This is still an issue. Fresh install of Gatsby Default Starter, then Produces the same errors as described above.
|
I will fix it - npm install core-js@3 |
How is this related to |
This worked for me. Thanks! |
This is a massive productivity killer. I've spent the last hour trying to bring my STARTER to life, just to add styled components! Docs need to reflect this IMO. |
since this problems are not sticked to special receipt, maybe it would be good to hava a faq section or most common problems with the recipes and how to solve this? |
I(new to gatsby) just got this problem for a new install. Sadly, I'm going back to CRA for now. |
I also had the same issue, probably after installing the plugin gatsby-plugin-sass. My workaround was this: npm install Cheers! |
I also had same issue after installing gatsby-plugin-sass. Used richardhealy solution above to fix. |
I would just like say that while it's an issue with npm, it is still a potential roadblock for new users. Consider this flow: ❯ gatsby new
✔ What is your project called? … my-very-first-gatsby
✔ What starter would you like to use? › gatsby-starter-hello-world
...
Your new Gatsby site has been successfully bootstrapped. Start developing it by running:
cd my-very-first-gatsby
gatsby develop
❯ cd my-very-first-gatsby
❯ gatsby develop
# (...Great! Works! let's add some images)
❯ npm install gatsby-image
❯ gatsby develop
**ERROR ERROR**
There was a problem loading the local develop command.
Gatsby may not be installed.
Perhaps you need to run "npm install"? Cannot find module 'react'
**Error: Cannot find module 'react'**
#(hmm...ok let's do what it says, run `npm install`)
❯ npm install
...
❯ gatsby develop
**Error: Invalid hook call. **
Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
# wtf
#?!?#! That's a terrible experience. |
Just installed default started, everything worked until I used |
Today, I had this error when installing Airtable plugin. I went to search for this issue and came across Issue #25556. So I tried to walk through the tutorials, and sure enough, I was able to replicate this error when reviewing https://www.gatsbyjs.org/tutorial/part-three/. At https://www.gatsbyjs.org/tutorial/part-three/, I ran into the problem:
ACTUAL:
Ran
@richardhealy Workaround worked:
|
Doing a "fresh" install will work with Yarn or npm: rm -rf node_modules package-lock.json
npm install
# OR
yarn (altho deleting the lock file could have undesirable effects as it will remove the version "lock" on all packages — allowing them to update the highest semver defined in |
You can also use |
@DanielRuf That's what I thought at first too, but I tried it and it didn't work for me: ❯ gatsby new try-ci https://github.com/gatsbyjs/gatsby-starter-hello-world
❯ cd try-ci
❯ gatsby develop
# (all good)
❯ npm i gatsby-image
❯ gatsby develop
# (errors)
❯ npm ci
# (still errors) |
What npm version do you use? The latest versions should work better. But I guess your problem is solved now. Just wanted to mention |
❯ npm -v
6.14.5 |
Oh yeah, gatsby needs to fix up. I was almost giving up as a new user. |
I'm facing the same issue after installing gatsby-plugin-sass and node-sass. I hope they fix this bug if it's related to Gatsby. |
Trying to resolve this error, i find yarn better for installing plugins in my <> gatsby project. 1.- remove the package-lock.json If you need yo add more plugins, try with: "yarn add gatsby-plugin-page-creator" instead "npm install --save gatsby-plugin-page-creator" Hope this little info works for ya! |
installed today react-bootsrap and I get the same error. Fix your shit ffs! |
npm install with yarn creates this issues: gatsbyjs#18048 using `yarn add` allows for an error free set up.
This issue should have been resolved in the latest gatsby-cli. If you already had it before please run the following command:
This will reset gatsby-cli to using npm and not yarn |
@wardpeet shouldn't that be this?
|
Still getting this error with the latest Gatsby and tutorial. |
New to gatsby - working through the official tutorial and encountered this error, just before I got this far (https://www.gatsbyjs.com/docs/tutorial/part-four/#your-first-graphql-query) `Generating development SSR bundle failed Can't resolve If you're trying to use a package make sure that File: .cache/caches/gatsby-plugin-typography/typography.js` |
Error: Cannot find module 'C:\Users\create-react-app\index.js' C:\Users\faranak&hassan\Desktop>cd .. C:\Users\faranak&hassan>npm install ../faye npm ERR! A complete log of this run can be found in: C:\Users\faranak&hassan>npm install -g create-react-app changed 67 packages in 17s 4 packages are looking for funding |
Description
When i followed the documentation i get an error. as @marcysutton suggested in #17318 (comment) i file a new issue about this.
Steps to reproduce
i followed the receipt (in draft) in #17318
steps i have done:
Expected result
no error - i should be able to run
gatsby develop
Actual result
here is got the error:
i could solved it with
npm install
- should we add it in this receipt to avoid confusing error messages?(after the install of the starter in Prerequisites i was able to run
gatsby develop
without error - we should add if after the step which requires a newnpm install
)Workaround
runnning
npm install
the
npm install
gives me this output and i see there are new packages installed and changed:Environment
The text was updated successfully, but these errors were encountered: