在 angular 5 中创建构建时出错

getting error while creating build in angular 5

  1. 我正在尝试创建构建并低于错误

    11 愚蠢的生命周期企业解决方案@0.0.0~开始:返回:代码:139 信号:空

    11 愚蠢的生命周期企业解决方案@0.0.0~开始:返回:代码:139 信号:空

    12 信息生命周期企业解决方案@0.0.0~启动:无法执行启动脚本

    13 详细堆栈退出状态 139

    13 EventEmitter 的详细堆栈。 (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)

    emitTwo 处有 13 个详细堆栈 (events.js:126:13)

    13 详细堆栈位于 EventEmitter.emit (events.js:214:7)

    13 ChildProcess 的详细堆栈。 (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)

    emitTwo 处有 13 个详细堆栈 (events.js:126:13)

    13 详细堆栈位于 ChildProcess.emit (events.js:214:7)

    13 详细堆栈位于 maybeClose (internal/child_process.js:925:16)

    13 详细堆栈位于 Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

also sometimes getting same error while start the Server

  1. npm版本v5.7.1
  2. 节点版本v8.9.3
  3. OS : ubuntu 16.04 LTS

below is my package.json

{
"name": "corporate-solutions",
"version": "0.0.0",
"scripts": {
    "ng": "ng",
    "start": "ng serve --ec true --port 4203 --host 0.0.0.0",
    "build": "node --max_old_space_size=5300 ./node_modules/.bin/ng build --prod",
    "win-build": "node --max_old_space_size=5300 ./node_modules/@angular/cli/bin/ng build --prod",
    "build-notify": "node --max_old_space_size=5300 ./node_modules/.bin/ng build --prod && echo 'message: Build Completed' | zenity --notification --listen",
    "build-push": "node --max_old_space_size=5300 ./node_modules/.bin/ng build --prod && ./distupload.sh",
    "gitbuild": "ng build --prod --base /start-angular/SB-Admin-BS4-Angular-4/master/dist/",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "start:dynamic": "npm run build:dynamic && npm run serve:dynamic",
    "start:static": "npm run build:static && npm run serve:static",
    "build:client-and-server-bundles": "ng build --prod && ng build --prod --app 1 --output-hashing=false",
    "build:static": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:static",
    "build:dynamic": "npm run build:client-and-server-bundles && npm run webpack:server",
    "generate:static": "cd dist && node prerender",
    "webpack:server": "webpack --config webpack.server.config.js --progress --colors",
    "serve:static": "cd dist/browser && http-server",
    "serve:dynamic": "node dist/server"
},
"private": true,
"dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/cdk": "^5.2.3",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^5.2.3",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/platform-server": "^4.3.6",
    "@angular/router": "^5.0.0",
    "@fortawesome/angular-fontawesome": "0.1.0-9",
    "@fortawesome/fontawesome-svg-core": "^1.2.0-11",
    "@fortawesome/free-brands-svg-icons": "^5.1.0-8",
    "@fortawesome/free-solid-svg-icons": "^5.1.0-8",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.8",
    "@ng-idle/core": "^2.0.0-beta.15",
    "@ng-idle/keepalive": "^2.0.0-beta.15",
    "@nguniversal/express-engine": "^1.0.0-beta.3",
    "@nguniversal/module-map-ngfactory-loader": "^1.0.0-beta.3",
    "@ngx-cache/core": "^4.0.1",
    "@nicky-lenaers/ngx-scroll-to": "^0.6.0",
    "angular-calendar": "^0.24.1",
    "angular-fontawesome": "^1.0.0",
    "angular-star-rating": "^3.0.8",
    "angular2-csv": "0.2.5",
    "angular2-highcharts": "^0.5.5",
    "angular2-jwt": "^0.2.3",
    "angular2-moment": "^1.7.0",
    "angular2-multiselect-dropdown": "2.5.0",
    "angular2piwik": "^0.1.5-beta",
    "body-parser": "^1.18.2",
    "bootstrap": "4.0.0-beta.2",
    "calendar-utils": "^0.1.2",
    "core-js": "^2.5.1",
    "express": "^4.16.2",
    "file-saver": "^1.3.3",
    "font-awesome": "^4.7.0",
    "formdata-polyfill": "^3.0.10",
    "grapesjs": "^0.14.10",
    "grapesjs-preset-webpage": "^0.1.9",
    "highcharts": "^6.0.2",
    "howler": "^2.1.1",
    "moment": "^2.19.1",
    "moment-timezone": "^0.5.16",
    "ng-click-outside": "^3.2.0",
    "ng-recaptcha": "^3.0.5",
    "ng2-charts": "^1.6.0",
    "ng2-img-cropper": "^0.9.0",
    "ng2-pdf-viewer": "^5.2.3",
    "ngx-bootstrap": "^2.0.5",
    "ngx-ckeditor": "^0.4.0",
    "ngx-file-drop": "^2.0.2",
    "ngx-google-places-autocomplete": "^2.0.1",
    "ngx-infinite-scroll": "^0.8.2",
    "ngx-perfect-scrollbar": "^5.3.1",
    "ngx-toastr": "^6.5.0",
    "robotjs": "^0.5.1",
    "rxjs": "^5.5.2",
    "socket.io": "^2.0.4",
    "survey-angular": "^1.0.51",
    "survey-jquery": "^1.0.51",
    "surveyjs-editor": "^1.0.51",
    "xlsx": "0.12.7",
    "zone.js": "^0.8.14"
},
"devDependencies": {
    "@angular/cli": "1.5.6",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "^2.5.52",
    "@types/node": "^8.0.10",
    "codelyzer": "~4.0.1",
    "cpy-cli": "^1.0.1",
    "http-server": "^0.10.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "^4.1.0",
    "karma": "^2.0.4",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "^1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.3.2",
    "reflect-metadata": "^0.1.10",
    "ts-loader": "^2.3.7",
    "ts-node": "~3.3.0",
    "tslint": "~5.8.0",
    "typescript": "~2.4.2"
}
}

所以我在 ubuntu 18.04 上安装了 nvm、nodejs 8.9.3、npm 5.7.1。我遇到的第一个问题是,我无法从 package.json 安装软件包,不得不使用 npm i npm@latest -g.

将 npm 更新到最新版本

下一个运行 npm告诉我那里有大约33个漏洞,其中一些漏洞很高,以至于我仍然无法安装软件包。经过一些 npm update, npm audit fix, npm audit fix --force 我终于可以安装软件包了。

然后我创建了一个新项目,npx ng new projectname 移到了该文件夹中并做了一个 npm run build。那奏效了。 所以首先我会建议你更新到当前的 nodejs / npm 版本,然后更新包并再次尝试 运行ning 构建。