我的package.json看起来像下面复制但我在部署时遇到错误。 我收到错误:没有可用的node.js版本匹配应用程序的版本约束。任何人都可以告诉我们错误。我已经给出了这个版本,因为WEBSITE_NODE_DEFAULT_VERSION的值为6.2.1。
的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": {}
}
答案 0 :(得分:1)
您选择的node.js版本6.2.1
在Azure网络应用程序上不可用。
该平台上可用的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.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.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-quickstart-on-azure更多信息。
如有任何疑问,请随时告诉我。
答案 1 :(得分:0)
或者,您应该可以使用semver来定义它更宽松:
"engines":{
"node":"^6.0.0"
},
应定位最新的6.x.x版本。
另一种有效的写作方式是:
"engines":{
"node":">=6.2.0 <6.5"
},
在6.2.0
和6.5.0
之间定位。