我正在尝试在开发人员模式下运行npm,但我一次又一次遇到此错误。我试图重新安装node_modules文件夹,清理缓存npm install
。
当我运行npm run build
时它可以工作,但不能与npm run dev
一起工作。
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn webpack-dev-server ENOENT
at notFoundError (C:\Users\big boss\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\big boss\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\big boss\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
Emitted 'error' event at:
at ChildProcess.cp.emit (C:\Users\big boss\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! y@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the y@1.0.0 dev 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! C:\Users\big boss\AppData\Roaming\npm-cache\_logs\2018-11-13T11_38_35_421Z-debug.log
谢谢您的帮助!