Module not found: Can't resolve 'react'
See original GitHub issueI am currently facing this problem when I attempt to install any node package into an app created with create-react-app
:
`npm WARN gentlyRm not removing /Users/user/Desktop/mobx-shopping/node_modules/espree/node_modules/.bin/acorn as it wasn’t installed by /Users/user/Desktop/mobx-shopping/node_modules/espree/node_modules/acorn npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN mobx-react@4.2.1 requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0-0 but none was installed.`
Then when I run the app with npm start
and it compiles, I get the following error:
Failed to compile.
./src/index.js
Module not found: Can't resolve 'react' in '/Users/user/Desktop/mobx-shopping/src'
Node version: 8.0.0 NPM version: 5.0.3 React: 15.6.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Can't resolve module (not found) in React.js - Stack Overflow
It seems you need import Header from './components/header/header' w/o src. File path is relative to importing file path. Then you need to export ......
Read more >Module not found: Can't resolve 'X' error in React | bobbyhadz
To solve the "Module not found: Can't resolve" error in React, make sure to install the package from the error message if it's...
Read more >module not found error | can not resolve react dom module
Join this channel to get access to perks:https://www.youtube.com/channel/UCoSpmr2KNOxjwE_B9ynUmig/joinMy GearCamera ...
Read more >How to fix 'Module not found: Can't resolve 'http' in ... - YouTube
Basically, just change ' react -scripts' to 4.0.2 in your package.json and run `npm install` again :D Follow me on Twitter: ......
Read more >[Solved] Module not found: Error: Can't resolve ... - Tealfeed
One potential issue that might be causing this issue could be versioning issues. The index.js file created after running npx create-react-app uses React...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try removing
package-lock.json
, runnpm install
and thennpm start
again. Please also share yourpackage.json
file.If it doesn’t help, install an older version of npm (e.g. 3.x). 5.x is still fairly buggy and might be causing this.
I’ll close because it is not an issue on our side. npm just failed to install the
react
module for some reason.Removing package-lock.json and then running npm install helped me, thanks!