vscode 打包报错 error code ELIFECYCLE error This is probably not a problem with npm. There is likely additional logging output abov

执行命令:npm run build

详细报错信息:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v14.4.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle nc-multipage-demo@1.0.0~prebuild: nc-multipage-demo@1.0.0
6 info lifecycle nc-multipage-demo@1.0.0~build: nc-multipage-demo@1.0.0
7 verbose lifecycle nc-multipage-demo@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle nc-multipage-demo@1.0.0~build: PATH: C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;H:\yywork\gytz\qianduan\ncc2005-multipage-nccloud\node_modules\.bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\ProgramData\Oracle\Java\javapathbbbb;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;H:\yywork\icbchome\ncchome-gytz\ncchome\ufjdk\bin;H:\soft\apache-maven-3.6.3\bin;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\NetSarang\Xshell 6\;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Roaming\npm;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\dotnet\;D:\work\elasticsearch-6.4.3\bin;C:\Users\work\AppData\Local\Microsoft\WindowsApps
9 verbose lifecycle nc-multipage-demo@1.0.0~build: CWD: H:\yywork\gytz\qianduan\ncc2005-multipage-nccloud
10 silly lifecycle nc-multipage-demo@1.0.0~build: Args: [ '/d /s /c', 'node ./config/index.js production' ]
11 silly lifecycle nc-multipage-demo@1.0.0~build: Returned: code: 1  signal: null
12 info lifecycle nc-multipage-demo@1.0.0~build: Failed to exec build script
13 verbose stack Error: nc-multipage-demo@1.0.0 build: `node ./config/index.js production`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid nc-multipage-demo@1.0.0
15 verbose cwd H:\yywork\gytz\qianduan\ncc2005-multipage-nccloud
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.4.0
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error nc-multipage-demo@1.0.0 build: `node ./config/index.js production`
22 error Exit status 1
23 error Failed at the nc-multipage-demo@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

解决方法:更新为最新版本的nodejs就行了,我目前用的是 node-v16.17.1-x64.msi  之前报错的版本是 v14.4.0

备注:还看了网上其他的解决办法,更新vscode版本也不好使,还有网上其他的都试过但是没有效果;

  例如:1:npm cache clean --force  

     2:删除node_modules

       3:删除 package-lock.json

       4:npm install

 可能这个方法适用于某些环境下吧,遇到问题还得多试试

 

posted @ 2022-09-26 10:48  寻水的鱼001  阅读(186)  评论(0编辑  收藏  举报