Reputation: 577
I was trying to get my AirBnB linting to work and decided to uninstall my npm packages in order to do a fresh install of my package.json
file.
I run the bash commands:
npm uninstall `ls -1 node_modules | tr '/\n' ' '`
After that, I followed the standard installation procedures for the codebase, which are only NPM installing in the right directory. I am pretty sure I did that right.
When running my Webpack set up npm start
everything was going right, until I got the following error:
to be executed: nodemon --exec babel-node bin/server --no_debug
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node bin/server --no_debug`
app:config Creating default configuration. +0ms
app:config Looking for environment overrides for NODE_ENV "development". +105ms
app:config Found overrides, applying to default configuration. +6ms
app:webpack:config Create configuration. +727ms
app:webpack:config Enable plugins for live development (HMR, NoErrors). +1ms
app:server:webpack-dev Enable webpack dev middleware. +385ms
app:server:webpack-hmr Enable Webpack Hot Module Replacement (HMR). +38ms
app:bin:server Server is now running at http://172.20.10.2:3000. +9ms
app:bin:server Server accessible via localhost:3000 if you are using the project defaults. +0ms
webpack built b6bb9c1f12e4a68bce6a in 9735ms
Hash: b6bb9c1f12e4a68bce6a
Version: webpack 1.13.3
Time: 9735ms
Asset Size Chunks Chunk Names
app.b6bb9c1f12e4a68bce6a.js 1.9 MB 0 app
vendor.b6bb9c1f12e4a68bce6a.js 664 kB 1 vendor
app.b6bb9c1f12e4a68bce6a.js.map 2.23 MB 0 app
vendor.b6bb9c1f12e4a68bce6a.js.map 808 kB 1 vendor
ERROR in ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js 15:29-72
ERROR in ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js 13:29-72
ERROR in ./~/react-dom/lib/ReactDOMInvalidARIAHook.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/ReactDOMInvalidARIAHook.js 14:29-72
ERROR in ./~/react-dom/lib/ReactDebugTool.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/ReactDebugTool.js 16:29-72
ERROR in ./~/react-dom/lib/ReactChildReconciler.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/ReactChildReconciler.js 29:27-70 37:31-74
ERROR in ./~/react-dom/lib/flattenChildren.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/flattenChildren.js 26:27-70 42:33-76
ERROR in ./~/react-dom/lib/checkReactTypeSpec.js
Module not found: Error: Cannot resolve module 'react/lib/ReactComponentTreeHook' in /Users/pedrofigueiredo/Documents/hs/src/healthsite/react/frontend/node_modules/react-dom/lib
@ ./~/react-dom/lib/checkReactTypeSpec.js 29:27-70 71:37-80
webpack: bundle is now VALID.
It seems to be related with the react version, but I find it hard to believe because I didn't change anything on my package.json
file.
Here's the relevant part for reference:
"dependencies": {
[...]
"react": "15.0.1",
"react-dom": "^15.0.0",
"react-redux": "^4.0.0",
"react-router": "^2.2.0",
"react-router-redux": "^4.0.0",
How do I fix this?
Upvotes: 0
Views: 164
Reputation: 15587
Consider using yarn as an alternative to NPM. Yarn provides deterministic installs by creating a yarn.lock file, which ensures that deps installed on different machines at different times all resolve to the same versions, similar to npm install --save-exact foo
.
Running yarn
(shorthand for yarn install
) is equivalent to rm -rf node_modules && npm install
, which is the first step for resolving npm issues, as @Yan Maleksi suggested.
Yarn will represent install conflicts differently to npm, too, which may make it easier to see which dependency is a problem. In your case, a search for 'Cannot resolve module 'react/lib/ReactComponentTreeHook' suggests that react-hot-loader may be a problem, but it's hard to tell without seeing the entire list of dependencies, and associated install errors.
Upvotes: 1