背景
我试图让我的 AirBnB linting 工作,并决定卸载我的 npm 包,以便重新安装我的package.json
文件。
我做了什么
我运行 bash 命令:
npm uninstall `ls -1 node_modules | tr '/\n' ' '`
之后,我按照代码库的标准安装程序,仅将 NPM 安装在正确的目录中。我很确定我做对了。
出乎意料的事
运行我的 Webpack 设置时,npm start
一切正常,直到出现以下错误:
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.
它似乎与 react 版本有关,但我很难相信,因为我没有更改package.json
文件上的任何内容。
以下是相关部分供参考:
"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",
我该如何解决?