internal/modules/cjs/loader.js:626 throw err; ^ Error: Cannot find module 'chalk' Require stack: - /Users/chelsea/Documents/code/react-template/server/logger.js - /Users/chelsea/Documents/code/react-template/server/index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15) at Function.Module._load (internal/modules/cjs/loader.js:527:27) at Module.require (internal/modules/cjs/loader.js:681:19) at require (internal/modules/cjs/helpers.js:16:16) at Object.<anonymous> (/Users/chelsea/Documents/code/react-template/server/logger.js:3:15) at Module._compile (internal/modules/cjs/loader.js:774:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) at Module.load (internal/modules/cjs/loader.js:641:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Module.require (internal/modules/cjs/loader.js:681:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/chelsea/Documents/code/react-template/server/logger.js', '/Users/chelsea/Documents/code/react-template/server/index.js' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! react-template@3.1.0 start: `cross-env NODE_ENV=development node server` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the react-template@3.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/chelsea/.npm/_logs/2019-06-19T01_42_14_852Z-debug.log
一、删除package-lock.json
这个文件,再启动仍是没有用node
二、清除缓存npm cache clear --force
,再启动仍是没有用react
三、从新安装这个模块npm install chalk
,再启动 又报了其它新的一个错webpack
四、综合第三点考虑,就删掉整个模块包rm -rf node_modules
,删除package-lock.json
,再清除缓存npm cache clear --force
,而后从新安装包npm install
web
最后运行起来了,但仍是报错npm
ERROR in ./app/containers/ComponentLifecycle/Step/index.js Module not found: Error: Can't resolve 'image-webpack-loader' in '/Users/chelsea/Documents/code/react-template' @ ./app/containers/ComponentLifecycle/Step/index.js 28:0-41 593:13-19 @ ./app/containers/ComponentLifecycle/Step/Loadable.js @ ./app/routers/index.js @ ./app/layouts/PrimaryLayout/index.js @ ./app/containers/App/index.js @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js ERROR in ./app/containers/ComponentLifecycle/Step/index.js Module not found: Error: Can't resolve 'image-webpack-loader' in '/Users/chelsea/Documents/code/react-template' @ ./app/containers/ComponentLifecycle/Step/index.js 27:0-41 564:13-19 @ ./app/containers/ComponentLifecycle/Step/Loadable.js @ ./app/routers/index.js @ ./app/layouts/PrimaryLayout/index.js @ ./app/containers/App/index.js @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js ERROR in ./app/containers/ComponentLifecycle/Step/index.js Module not found: Error: Can't resolve 'image-webpack-loader' in '/Users/chelsea/Documents/code/react-template' @ ./app/containers/ComponentLifecycle/Step/index.js 26:0-41 518:13-19 @ ./app/containers/ComponentLifecycle/Step/Loadable.js @ ./app/routers/index.js @ ./app/layouts/PrimaryLayout/index.js @ ./app/containers/App/index.js @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js ERROR in ./app/containers/ComponentLifecycle/Step/index.js Module not found: Error: Can't resolve 'image-webpack-loader' in '/Users/chelsea/Documents/code/react-template' @ ./app/containers/ComponentLifecycle/Step/index.js 25:0-41 454:13-19 @ ./app/containers/ComponentLifecycle/Step/Loadable.js @ ./app/routers/index.js @ ./app/layouts/PrimaryLayout/index.js @ ./app/containers/App/index.js @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js ERROR in ./app/containers/ComponentLifecycle/Step/index.js Module not found: Error: Can't resolve 'image-webpack-loader' in '/Users/chelsea/Documents/code/react-template' @ ./app/containers/ComponentLifecycle/Step/index.js 24:0-41 415:13-19 @ ./app/containers/ComponentLifecycle/Step/Loadable.js @ ./app/routers/index.js @ ./app/layouts/PrimaryLayout/index.js @ ./app/containers/App/index.js @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js ERROR in ./app/containers/ComponentLifecycle/Step/index.js Module not found: Error: Can't resolve 'image-webpack-loader' in '/Users/chelsea/Documents/code/react-template' @ ./app/containers/ComponentLifecycle/Step/index.js 23:0-41 371:13-19 @ ./app/containers/ComponentLifecycle/Step/Loadable.js @ ./app/routers/index.js @ ./app/layouts/PrimaryLayout/index.js @ ./app/containers/App/index.js @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js
最后改用yarn
安装模块, 安装了几回。最后启动yarn start
终于没有报错了json