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

"Module not found: Error: Cannot resolve module" for react-router and react #30

Open
frg opened this issue Jul 5, 2015 · 7 comments
Open

Comments

@frg
Copy link

frg commented Jul 5, 2015

Hi,

Hopefully this is not a total noob question, but;

When I run 'webpack' I keep getting a "Module not found: Error: Cannot resolve module" for 'react-router' and 'react'.

Just for clarity I'm running 'npm install' in the example directory and then running 'webpack' in the same directory.

Would appreciate it if someone could help me out :)

Thanks in advance,
Jean

@coryhouse
Copy link

I'm getting the same. Running on OSX. Here's my version info:

npm version
{ 'webpack-howto-example': '1.0.0',
npm: '2.9.1',
http_parser: '2.3',
modules: '14',
node: '0.12.3',
openssl: '1.0.1m',
uv: '1.5.0',
v8: '3.28.71.19',
zlib: '1.2.8' }

And here's the output of running npm start:
npm start

webpack-howto-example@1.0.0 start /Users/coryhouse/Desktop/webpack-howto/example
webpack-dev-server

http://localhost:8080/webpack-dev-server/
webpack result is served from /
content is served from /Users/coryhouse/Desktop/webpack-howto/example
Hash: 095a517d0e7e20ad100b
Version: webpack 1.10.1
Time: 237ms
Asset Size Chunks Chunk Names
bundle.js 11.4 kB 0 [emitted] main
chunk {0} bundle.js (main) 8.74 kB [rendered]
[0] ./modules/main.js 547 bytes {0} [built] [2 errors]
[1] ./modules/App.js 554 bytes {0} [built] [2 errors]
[2] ./modules/App.css 1.15 kB {0} [built]
[3] .//css-loader!./modules/App.css 200 bytes {0} [built]
[4] ./
/css-loader/cssToString.js 352 bytes {0} [built]
[5] ./~/style-loader/addStyles.js 5.51 kB {0} [built]
[6] ./modules/Home.js 214 bytes {0} [built] [1 error]
[7] ./modules/About.js 218 bytes {0} [built] [1 error]

ERROR in ./modules/main.js
Module not found: Error: Cannot resolve module 'react' in /Users/coryhouse/Desktop/webpack-howto/example/modules
@ ./modules/main.js 6:12-28

ERROR in ./modules/main.js
Module not found: Error: Cannot resolve module 'react-router' in /Users/coryhouse/Desktop/webpack-howto/example/modules
@ ./modules/main.js 7:13-36

ERROR in ./modules/Home.js
Module not found: Error: Cannot resolve module 'react' in /Users/coryhouse/Desktop/webpack-howto/example/modules
@ ./modules/Home.js 3:12-28

ERROR in ./modules/App.js
Module not found: Error: Cannot resolve module 'react' in /Users/coryhouse/Desktop/webpack-howto/example/modules
@ ./modules/App.js 3:12-28

ERROR in ./modules/App.js
Module not found: Error: Cannot resolve module 'react-router' in /Users/coryhouse/Desktop/webpack-howto/example/modules
@ ./modules/App.js 4:12-35

ERROR in ./modules/About.js
Module not found: Error: Cannot resolve module 'react' in /Users/coryhouse/Desktop/webpack-howto/example/modules
@ ./modules/About.js 3:12-28
webpack: bundle is now VALID.

@tcoopman
Copy link

tcoopman commented Jul 7, 2015

I see that the package.json points to the git master for both react and react-router. Have you tried with the latest stable versions?

@coryhouse
Copy link

@tcoopman Good call! I uninstalled react, router-router, and react-tools and then reinstalled them to remove the hard reference to master. It now runs without error.

So looks like the simple fix is to remove the hard reference to master in package.json.

tcoopman added a commit to tcoopman/webpack-howto that referenced this issue Jul 8, 2015
@tcoopman
Copy link

tcoopman commented Jul 8, 2015

create a PR #32

@gaurav-technologydata
Copy link

./src/Component/Form.js
Module not found: Can't resolve '../axios' in 'F:\React\react-complete-guide\src\Component'

i am getting this issue........i have deleted that json-lock file then fire npm install command then npm start still i m getting same issue

@gaurav-technologydata
Copy link

this question is already asked by no. of people but still there is no answer

@KaviiChathuranga
Copy link

please tell how to fix modules missing error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants