question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module not found: Can't resolve 'react'

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

26reactions
gaearoncommented, Jun 14, 2017

Try removing package-lock.json, run npm install and then npm start again. Please also share your package.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.

4reactions
maciej-gurbancommented, Jun 15, 2017

Removing package-lock.json and then running npm install helped me, thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found