npm run ERR! code ELIFECYCLE
vue项目在npm run dev 时报错错误信息如下
0 info it worked if it ends with ok 1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'dev' ] 2 info using npm@4.0.5 3 info using node@v7.4.0 4 verbose run-script [ 'predev', 'dev', 'postdev' ] 5 info lifecycle uf-studio@1.0.0~predev: uf-studio@1.0.0 6 silly lifecycle uf-studio@1.0.0~predev: no script for predev, continuing 7 info lifecycle uf-studio@1.0.0~dev: uf-studio@1.0.0 8 verbose lifecycle uf-studio@1.0.0~dev: unsafe-perm in lifecycle true 9 verbose lifecycle uf-studio@1.0.0~dev: PATH: D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;E:\project\xarm\studio\node_modules\.bin;D:\software\cmder\vendor\conemu-maximus5\ConEmu\Scripts;D:\software\cmder\vendor\conemu-maximus5;D:\software\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Python27;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\ufactory\AppData\Local\Programs\Python\Python36;rogramData\chocolatey\bin;rogram Files (x86)\Yarn\bin\;D:\Program Files\nodejs\;C:\Users\ufactory\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;E:\windowsPath\redis\;E:\windowsPath\Git\cmd;D:\software\jdk8\jdk8\bin;C:\Users\ufactory\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\ufactory\AppData\Local\Programs\Python\Python36\;C:\Users\ufactory\AppData\Local\Microsoft\WindowsApps;C:\Users\ufactory\AppData\Local\Yarn\bin;D:\Program Files\Bandizip\;C:\Users\ufactory\AppData\Roaming\npm;E:\windowsPath\cmder;D:\software\Microsoft VS Code\bin;E:\windowsPath\PyCharm 2019.2.5\bin;C:\MinGW\bin;E:\windowsPath\Git\cmd;E:\windowsPath\Git\mingw64\bin;E:\windowsPath\Git\usr\bin;D:\software\cmder\vendor\bin;D:\software\cmder\bin;D:\software\cmder;D:\software\cmder\vendor\git-for-windows\cmd;D:\software\cmder\vendor\git-for-windows\mingw64\bin;D:\software\cmder\vendor\git-for-windows\usr\bin;D:\software\cmder\vendor\bin;D:\software\cmder 10 verbose lifecycle uf-studio@1.0.0~dev: CWD: E:\project\xarm\studio 11 silly lifecycle uf-studio@1.0.0~dev: Args: [ '/d /s /c', 11 silly lifecycle 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ] 12 silly lifecycle uf-studio@1.0.0~dev: Returned: code: 1 signal: null 13 info lifecycle uf-studio@1.0.0~dev: Failed to exec dev script 14 verbose stack Error: uf-studio@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` 14 verbose stack Exit status 1 14 verbose stack at EventEmitter.<anonymous> (D:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at EventEmitter.emit (events.js:191:7) 14 verbose stack at ChildProcess.<anonymous> (D:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at ChildProcess.emit (events.js:191:7) 14 verbose stack at maybeClose (internal/child_process.js:885:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 15 verbose pkgid uf-studio@1.0.0 16 verbose cwd E:\project\xarm\uf-studio 17 error Windows_NT 10.0.18363 18 error argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev" 19 error node v7.4.0 20 error npm v4.0.5 21 error code ELIFECYCLE 22 error uf-studio@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` 22 error Exit status 1 23 error Failed at the uf-studio@1.0.0 dev script 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js'. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the uf-studio package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 23 error You can get information on how to open an issue for this project with: 23 error npm bugs uf-studio 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls uf-studio 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ]
解决办法
#(1)第一步 npm cache clean --force #(2)第二步 删除node_modules文件夹 linux上:rm -rf node_modules window上: 直接手动删除 #(3)如果有package-lock.json文件就删除它,没有不用管,直接跳到第(4)步 linux上:rm -rf package-lock.json window上: 直接手动删除 # (4)安装模块 npm install
参考地址 https://stackoverflow.com/questions/42308879/npm-err-code-elifecycle