而在Azure上部署应用程序Angular2节点版本错误(Node version error wh

2019-09-27 01:35发布

我的package.json看起来像下面复制,但同时部署我得到的错误。 我得到的错误:没有可用的node.js版本应用程序的版本匹配的约束。 谁能告诉什么错误。 我给这个版本WEBSITE_NODE_DEFAULT_VERSION的值为6.2.1。

PFB快照:

的package.json

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "engines": {
    "node": "6.2.1"
  }, 
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "docker-build": "docker build -t ng2-quickstart .",
    "docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart",
    "pree2e": "npm run webdriver:update",
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "node_modules\\.bin\\lite-server",
    "postinstall": "typings install",
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "test-once": "tsc && karma start karma.conf.js --single-run",
    "tsc": "node_modules\\.bin\\tsc",
    "concurrently": "node_modules\\.bin\\concurrently",
    "tsc:w": "node_modules\\.bin\\tsc -w",
    "typings": "node_modules\\.bin\\typings",
    "webdriver:update": "webdriver-manager update"
  },
  "keywords": [],
  "author": "",
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/angular/angular.io/blob/master/LICENSE"
    }
  ],
  "dependencies": {
    "@angular/common": "~2.1.0",
    "@angular/compiler": "~2.1.0",
    "@angular/core": "~2.1.0",
    "@angular/forms": "~2.1.0",
    "@angular/http": "~2.1.0",
    "@angular/platform-browser": "~2.1.0",
    "@angular/platform-browser-dynamic": "~2.1.0",
    "@angular/router": "~3.1.0",
    "@angular/upgrade": "~2.1.0",

    "angular-in-memory-web-api": "~0.1.5",
    "bootstrap": "^3.3.7",
    "systemjs": "0.19.39",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "^0.6.25",
    "concurrently": "^3.0.0",
    "lite-server": "^2.2.2",
    "typescript": "^2.0.3",
    "typings": "^1.4.0"
  },
  "devDependencies": {
    "concurrently": "^3.0.0",
    "lite-server": "^2.2.2",
    "typescript": "^2.0.3",
    "typings": "^1.4.0",

    "canonical-path": "0.0.2",
    "http-server": "^0.9.0",
    "tslint": "^3.15.1",
    "lodash": "^4.16.2",
    "jasmine-core": "~2.5.2",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-htmlfile-reporter": "^0.3.4",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^3.3.0",
    "rimraf": "^2.5.4"
  },
  "repository": {}
}

Answer 1:

随着Node.js的版本6.2.1你选择哪一种不可在Azure上的Web应用程序。 在该平台上使用Node.js的版本是:

`0.6.20,0.8.2,0.8.19,0.8.26,0.8.27,0.8.28,0.10.5,0.10.18,0.10.21,0.10.24,0.10.26,0.10.28,0.10 0.29,0.10.31,0.10.32,0.10.40,0.12.0,0.12.2,0.12.3,0.12.6,4.0.0,4.1.0,4.1.2,4.2.1,4.2.2 ,4.2.3,4.2.4,4.3.0,4.3.2,4.4.0,4.4.1,4.4.6,4.4.7,4.5.0,4.6.0,4.6.1,5.0.0,5.1 0.1,5.3.0,5.4.0,5.5.0,5.6.0,5.7.0,5.7.1,5.8.0,5.9.1,6.0.0,6.1.0,6.2.2,6.3.0 ,6.5.0,6.6.0,6.7.0,6.9.0。

请尽量使用6.2.2代替,或者你可以尽量选择上方的可用版本之一。

此外,你可以参考angular2,快速入门,上蔚蓝色的更多信息。

任何进一步的问题,请随时让我知道。



Answer 2:

另外,您应该能够与宽松的定义它semver :

  "engines":{
    "node":"^6.0.0"
  },

应针对最新版本6.XX。


写这将是另一种有效途径:

  "engines":{
    "node":">=6.2.0 <6.5"
  },

为了目标之间的6.2.06.5.0

见NPM公司的package.json引擎规格 。



文章来源: Node version error while deploying Angular2 app on Azure