如何使用npm run build修复此错误?

时间:2019-02-01 07:22:27

标签: node.js angular npm webpack

运行npm run build时出现以下错误。我也有一个名为npm run fresh build的命令,该命令在另一个命令之后运行3个命令,但是问题似乎出在run build命令上。以下是我的代码和出现的错误。

"scripts": {
"fresh-build": "npm update && npm prune && npm run build",
"build": "rimraf dist && webpack --progress --profile --display- 
chunks --bail",

这是我遇到的错误:

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nitrogen@0.8.0 build: `rimraf dist && webpack --progress -- 
profile --display-chunks --bail`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the nitrogen@0.8.0 build 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!     /Users/ldb/.npm/_logs/2019-02-01T07_15_27_998Z- 
debug.log`

以下是日志文件的内容:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@5.6.0
3 info using node@v8.11.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle nitrogen@0.8.0~prebuild: nitrogen@0.8.0
6 info lifecycle nitrogen@0.8.0~build: nitrogen@0.8.0
7 verbose lifecycle nitrogen@0.8.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle nitrogen@0.8.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/ldb/Documents/Development/Work/Nitrogen/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle nitrogen@0.8.0~build: CWD: /Users/ldb/Documents/Development/Work/Nitrogen
10 silly lifecycle nitrogen@0.8.0~build: Args: [ '-c',
10 silly lifecycle   'rimraf dist && webpack --progress --profile --display-chunks --bail' ]
11 silly lifecycle nitrogen@0.8.0~build: Returned: code: 2  signal: null
12 info lifecycle nitrogen@0.8.0~build: Failed to exec build script
13 verbose stack Error: nitrogen@0.8.0 build: `rimraf dist && webpack --progress --profile --display-chunks --bail`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid nitrogen@0.8.0
15 verbose cwd /Users/ldb/Documents/Development/Work/Nitrogen
16 verbose Darwin 18.0.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v8.11.3
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 2
22 error nitrogen@0.8.0 build: `rimraf dist && webpack --progress --profile --display-chunks --bail`
22 error Exit status 2
23 error Failed at the nitrogen@0.8.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

0 个答案:

没有答案