npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! koa2-es10@1.0.0 start: nodemon --exec npm run babel
npm ERR! errno 1 npm ERR! koa2-es10@1.0.0 start: nodemon --exec npm run babel
的解决方法
安装es10-cli 脚手架后,启动项目时遇到时发生的node_modules丢失问题
Harry@Sheep MINGW64 /d/Study/Microsoft VS Code Workspace/ES6-10/es2019
$ npm start
> koa2-es10@1.0.0 start D:\Study\Microsoft VS Code Workspace\ES6-10\es2019
> nodemon --exec npm run babel
'nodemon' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
▒▒▒▒▒▒▒▒▒ļ▒▒▒
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! koa2-es10@1.0.0 start: `nodemon --exec npm run babel`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the koa2-es10@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Study\NodeJs\node_cache\_logs\2020-06-20T11_34_02_410Z-debug.log
错误原因在于文件 node_modules 在项目中丢失
解决方法
#1.在命令行中先进入文件所在路径
#2.然后输入命令 npm i
Harry@Sheep MINGW64 /d/Study/Microsoft VS Code Workspace/ES6-10/es2019
$ npm i
> nodemon@1.19.0 postinstall D:\Study\Microsoft VS Code Workspace\ES6-10\es2019\node_m odules\nodemon
> node bin/postinstall || exit 0
> webpack-cli@3.3.2 postinstall D:\Study\Microsoft VS Code Workspace\ES6-10\es2019\nod e_modules\webpack-cli
> node ./bin/opencollective.js
Thanks for using Webpack!
Please consider donating to our Open Collective
to help us maintain this package.
Donate: https://opencollective.com/webpack/donate
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents) :
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 772 packages from 361 contributors in 75.286s
Harry@Sheep MINGW64 /d/Study/Microsoft VS Code Workspace/ES6-10/es2019
$ npm start
> koa2-es10@1.0.0 start D:\Study\Microsoft VS Code Workspace\ES6-10\es2019
> nodemon --exec npm run babel
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `npm run babel`
> koa2-es10@1.0.0 babel D:\Study\Microsoft VS Code Workspace\ES6-10\es2019
> babel-node app.js
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Sat, 20 Jun 2020 11:37:26 GMT koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://githu b.com/koajs/koa/blob/master/docs/migration.md at app.js:39:5
server is listen, http://localhost:8080
(node:7136) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
webpack built 7895160d0283794de298 in 337ms