当我在Laravel中执行npm run watch时,出现以下错误:
Error: spawn node_modules/webpack/bin/webpack.js ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:379:16)
at process._tickCallback (internal/process/next_tick.js:114:19)
at Function.Module.runMain (module.js:692:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:666:3
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:207:12)
at onErrorNT (internal/child_process.js:379:16)
[... lines matching original stack trace ...]
at bootstrap_node.js:666:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-module --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development 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! /home/devel2/.npm/_logs/2018-04-10T09_06_26_796Z-debug.log
我尝试修复更改package.json并重新安装npm https://github.com/laravel/laravel/blob/master/package.json
另外,我尝试运行以下命令:
Step1:作曲家更新 第2步:rm -rf node_modules Step3:npm缓存清理 Step4:npm install Step5:npm过时了 在这一步中,我将laravel-mix版本更新为1.2.0,它位于package.json中。 Step6:npm install Step7:npm run dev
但它尚未奏效。