我正在尝试运行“npm run build:prod”,但我在 Ubuntu 16.04 上遇到了我在 Windows 10 中看不到的错误。我有最新版本的 npm 和 node。我不知道这是 npm 还是 angular 的问题。
我检查了调试日志,它说它在 angular 2 node js 脚本上失败了......但并没有真正指出我有任何问题的任何特定模块。
npm-v:5.3.0 节点-v:8.6.0
package.json
{
"name": "angular2-nodejs",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"build": "del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch",
"build:prod": "del-cli public/js/app && ngc -p tsconfig.aot.json && ngc -p tsconfig.aot.json && webpack --config webpack.config.prod.js --progress --profile --bail && del-cli 'public/js/app/**/*.js' 'public/js/app/**/*.js.map' '!public/js/app/bundle.js' '!public/js/app/*.chunk.js' 'assets/app/**/*.ngfactory.ts' 'assets/app/**/*.shim.ts'",
"ngc": "ngc"
},
"dependencies": {
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/compiler-cli": "0.6.3",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/http": "2.0.1",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/platform-server": "2.0.1",
"@angular/router": "3.0.1",
"@angular/upgrade": "2.0.1",
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"core-js": "^2.4.1",
"debug": "~2.2.0",
"express": "~4.13.4",
"hbs": "~4.0.0",
"morgan": "~1.7.0",
"rxjs": "5.0.0-beta.12",
"serve-favicon": "~2.3.0",
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/core-js": "0.9.34",
"@types/node": "6.0.45",
"angular2-router-loader": "^0.3.2",
"angular2-template-loader": "^0.5.0",
"awesome-typescript-loader": "^2.2.4",
"aws-sdk": "^2.79.0",
"del-cli": "^0.2.0",
"express": "^4.13.4",
"file-loader": "^0.11.2",
"html-loader": "^0.4.4",
"image-webpack-loader": "^3.3.1",
"nodemailer": "^4.0.1",
"raw-loader": "^0.5.1",
"typescript": "2.0.3",
"webpack": "2.1.0-beta.21",
"webpack-merge": "^0.14.1"
}
}
调试日志
info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm@5.3.0
3 info using node@v8.6.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle angular2-nodejs@0.0.0~prebuild: angular2-nodejs@0.0.0
6 info lifecycle angular2-nodejs@0.0.0~build: angular2-nodejs@0.0.0
7 verbose lifecycle angular2-nodejs@0.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle angular2-nodejs@0.0.0~build: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/tony/web/sa_website/node_modules/.bin:/home/tony/bin:/home/tony/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle angular2-nodejs@0.0.0~build: CWD: /home/tony/web/sa_website
10 silly lifecycle angular2-nodejs@0.0.0~build: Args: [ '-c',
10 silly lifecycle 'del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch' ]
11 silly lifecycle angular2-nodejs@0.0.0~build: Returned: code: 126 signal: null
12 info lifecycle angular2-nodejs@0.0.0~build: Failed to exec build script
13 verbose stack Error: angular2-nodejs@0.0.0 build: `del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at EventEmitter.emit (events.js:213:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at ChildProcess.emit (events.js:213:7)
13 verbose stack at maybeClose (internal/child_process.js:927:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid angular2-nodejs@0.0.0
15 verbose cwd /home/tony/web/sa_website
16 verbose Linux 4.8.0-58-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v8.6.0
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 126
22 error angular2-nodejs@0.0.0 build: `del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch`
22 error Exit status 126
23 error Failed at the angular2-nodejs@0.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]