我想将basik Angular代码发布到Codeship,然后发布到heroku。但是我有一个我无法解决的问题。我得到了this error
我搜索了一下,发现该节点版本太旧了,但是我计算机中的节点版本是最新的6.11.0,npm 3.10.10。

    {
  "name": "anonymous",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "http-server dist -p $PORT",
    "build": "ng build",
    "test": "ng test --single-run",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ng build --aot -prod"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/cli": "1.1.1",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "core-js": "^2.4.1",
    "http-server": "^0.10.0",
    "node-wget": "^0.4.2",
    "rxjs": "^5.1.0",
    "wget": "0.0.1",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/language-service": "^4.2.1",
    "@types/jasmine": "2.5.45",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "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.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}


我不知道在角度项目中在哪里设置节点版本。

最佳答案

您看到此错误是因为Codeship构建服务器使用的Node版本太旧。
根据您的error message,它当前正在使用版本v0.10.48

您需要在CodeShip部署中更新节点版本。

假设您使用的是自定义脚本,则需要以下一行。

#Update node to version 6.11.0
nvm install 6.11.0


请注意,Angular CLI需要Node 4.1或更高版本。

关于javascript - Codeship中的 Angular 代码,然后是Heroku,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44476937/

10-12 22:22