npm run dev error [npm ERR! code ELIFECYCLE]

 info it worked if it ends with ok
 verbose cli [ 'd:\\develop\\nodejs\\node.exe',
 verbose cli 'd:\\develop\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
 verbose cli 'run',
 verbose cli 'dist' ]
 info using [email protected]
 info using [email protected]
 verbose run-script [ 'predist', 'dist', 'postdist' ]
 info lifecycle [email protected]~predist: [email protected]
 info lifecycle [email protected]~dist: [email protected]
 verbose lifecycle [email protected]~dist: unsafe-perm in lifecycle true
 verbose lifecycle [email protected]~dist: PATH: d:\develop\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;d:\webpack_pro\datasync_webpack\node_modules\.bin;c:\Users\Administrator\bin;.;e:\Program Files (x86)\Git\local\bin;e:\Program Files (x86)\Git\mingw\bin;e:\Program Files (x86)\Git\bin;e:\Program Files (x86)\Git\bin;d:\develop\Ruby23-x64\bin;c:\Python27\;c:\Python27\Scripts;c:\Program Files (x86)\Common Files\NetSarang;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft\Web Platform Installer\;e:\Program Files\TortoiseSVN\bin;c:\ProgramData\chocolatey\bin;d:\develop\Java\jdk1.8.0_151\bin;d:\develop\Java\jdk1.8.0_151\jre\bin;d:\develop\Java\jdk1.8.0_151;d:\develop\mysql\bin;c:\Users\Administrator\AppData\Local\Yarn\bin;d:\develop\nodejs\;d:\develop\apache-maven-3.5.0\bin;d:\develop\Android\sdk\platform-tools;d:\develop\Android\sdk\tools;d:\develop\vsCode\bin;d:\develop\npm_global
 verbose lifecycle [email protected]~dist: CWD: d:\webpack_pro\datasync_webpack
 silly lifecycle [email protected]~dist: Args: [ '/d /s /c', 'webpack -p' ]
 silly lifecycle [email protected]~dist: Returned: code: 2 signal: null
 info lifecycle [email protected]~dist: Failed to exec dist script
 verbose stack Error: [email protected] dist: `webpack -p`
 verbose stack Exit status 2
 verbose stack at EventEmitter.<anonymous> (d:\develop\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
 verbose stack at EventEmitter.emit (events.js:182:13)
 verbose stack at ChildProcess.<anonymous> (d:\develop\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
 verbose stack at ChildProcess.emit (events.js:182:13)
 verbose stack at maybeClose (internal/child_process.js:962:16)
 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
 verbose pkgid [email protected]
 verbose cwd d:\webpack_pro\datasync_webpack
 verbose Windows_NT 6.1.7601
 verbose argv "d:\\develop\\nodejs\\node.exe" "d:\\develop\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dist"
 verbose node v10.13.0
 verbose npm v6.4.1

 error code ELIFECYCLE
 error errno 2
 error [email protected] dist: `webpack -p`
 error Exit status 2
 error Failed at the [email protected] dist script.
 error This is probably not a problem with npm. There is likely additional logging output above.
 verbose exit [ 2, true ]

出现此问题是node_modules出现错误,需要执行:

1 rm -rf node_modules
2 rm package-lock.json
3 npm cache clear --force
4 npm install

问题解决

猜你喜欢

转载自www.cnblogs.com/dapengFly/p/10208459.html