【问题标题】:package.json fails with error Windows_NT 6.2.9200 on azurepackage.json 在 azure 上失败并出现错误 Windows_NT 6.2.9200
【发布时间】:2017-03-07 14:05:07
【问题描述】:

我正在尝试在 azure 上部署 angular2 网站。在 azure 上部署时,我的 package.json 中的 postinstall 命令会引发错误。谁能建议可能导致此错误的原因? PFB 快照: 我的 postinstall 命令如下所示:

"postinstall": "typings install && tsc"

如果我不在这里写“&& tsc”,那么 ts 文件不会被编译为 js,但部署是干净的。

部署错误日志:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling node.js deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'npm-debug.log'
Copying file: 'package.json'
Invalid start-up command "tsc && concurrently "tsc -w" "lite-server" " in package.json. Please use the format "node <script relative path>".
Looking for app.js/server.js under site root.
Missing server.js/app.js files, web.config is not generated
Node.js versions available on the platform are: 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.9.1, 7.0.0.
Selected node.js version 6.1.0. Use package.json file to choose a different version.
Selected npm version 3.8.6
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml

> angular-quickstart@1.0.0 postinstall D:\home\site\wwwroot
> typings install && tsc

typings WARN deprecated 9/14/2016: "registry:dt/selenium-webdriver#2.44.0+20160317120654" is deprecated (updated, replaced or removed)
typings WARN deprecated 9/14/2016: "registry:dt/core-js#0.0.0+20160725163759" is deprecated (updated, replaced or removed)
typings WARN deprecated 9/14/2016: "registry:dt/angular-protractor#1.5.0+20160425143459" is deprecated (updated, replaced or removed)
typings WARN deprecated 10/19/2016: "registry:dt/node#6.0.0+20160831021119" is deprecated (updated, replaced or removed)
typings WARN deprecated 10/3/2016: "registry:dt/jasmine#2.2.0+20160621224255" is deprecated (updated, replaced or removed)
�[?25h
+-- angular-protractor (global)
+-- core-js (global)
+-- jasmine (global)
+-- node (global)
`-- selenium-webdriver (global)


npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm WARN angular-quickstart@1.0.0 No license field.
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "D:\\Program Files (x86)\\nodejs\\6.1.0\\node.exe" "D:\\Program Files (x86)\\npm\\3.8.6\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
npm ERR! node v6.1.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart@1.0.0 postinstall: `typings install && tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the angular-quickstart@1.0.0 postinstall script 'typings install && tsc'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\6.1.0\node.exe" "D:\Program Files (x86)\npm\3.8.6\node_modules\npm\bin\npm-cli.js" install --production
npm ERR! Tell the author that this fails on your system:
An error has occurred during web site deployment.
npm ERR!     typings install && tsc
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log
Invalid start-up command "tsc && concurrently "tsc -w" "lite-server" " in package.json. Please use the format "node <script relative path>".\r\nMissing server.js/app.js files, web.config is not generated\r\ntypings WARN deprecated 9/14/2016: "registry:dt/selenium-webdriver#2.44.0+20160317120654" is deprecated (updated, replaced or removed)\r\ntypings WARN deprecated 9/14/2016: "registry:dt/core-js#0.0.0+20160725163759" is deprecated (updated, replaced or removed)\r\ntypings WARN deprecated 9/14/2016: "registry:dt/angular-protractor#1.5.0+20160425143459" is deprecated (updated, replaced or removed)\r\ntypings WARN deprecated 10/19/2016: "registry:dt/node#6.0.0+20160831021119" is deprecated (updated, replaced or removed)\r\ntypings WARN deprecated 10/3/2016: "registry:dt/jasmine#2.2.0+20160621224255" is deprecated (updated, replaced or removed)\r\n\r\nnpm WARN optional Skipping failed optional dependency /chokidar/fsevents:\r\nnpm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14\r\nnpm WARN angular-quickstart@1.0.0 No license field.\r\nnpm ERR! Windows_NT 6.2.9200\r\nnpm ERR! argv "D:\\Program Files (x86)\\nodejs\\6.1.0\\node.exe" "D:\\Program Files (x86)\\npm\\3.8.6\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"\r\nnpm ERR! node v6.1.0\r\nnpm ERR! npm  v3.8.6\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! angular-quickstart@1.0.0 postinstall: `typings install && tsc`\r\nnpm ERR! Exit status 2\r\nnpm ERR! \r\nnpm ERR! Failed at the angular-quickstart@1.0.0 postinstall script 'typings install && tsc'.\r\nnpm ERR! Make sure you have the latest version of node.js and npm installed.\r\nnpm ERR! If you do, this is most likely a problem with the angular-quickstart package,\r\nnpm ERR! not with npm itself.\r\nnpm ERR! Tell the author that this fails on your system:\r\nnpm ERR!     typings install && tsc\r\nnpm ERR! You can get information on how to open an issue for this project with:\r\nnpm ERR!     npm bugs angular-quickstart\r\nnpm ERR! Or if that isn't available, you can get their info via:\r\nnpm ERR!     npm owner ls angular-quickstart\r\nnpm ERR! There is likely additional logging output above.\r\n\r\nnpm ERR! Please include the following file with any support request:\r\nnpm ERR!     D:\home\site\wwwroot\npm-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\58.51026.2494\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

我也尝试了 npm cache clean 但它没有用。

这是我的 package.json:

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "engines": {
    "node": "6.1.0",
    "npm": "3.8.6"
  }, 
  "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 && tsc",
    "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",
    "ng2-bootstrap": "^1.1.14",
    "moment": "^2.15.2",
    "firebase": "3.3.0",
    "angularfire2": "^2.0.0-beta.5",
    "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": {}
}

【问题讨论】:

  • 转到 Azure 门户,选择您的应用服务,然后选择开发工具,单击控制台。然后在控制台中输入以下内容:npm cache clean.
  • @AaronChen 感谢分享。我试过这个命令,但仍然得到同样的错误。
  • 我们通常在 npm2 中看到这一点。你在用 npm3 吗?该问题也有一些解决方法:github.com/npm/npm/issues/9696#issuecomment-256271475
  • 例如 --force 绕过缓存和竞争条件。我链接的问题是 npm2 在慢速 I/O 机器上将深度图写入缓存的竞赛。
  • @bryanmac 是的,我正在使用 npm3。在 azure 上部署时我应该在哪里包含 --force

标签: node.js azure angular npm npm-install


【解决方案1】:

根据angularfire2在https://github.com/angular/angularfire2/blob/master/package.json#L42的相对依赖,看来firebase版本需要是3.3.0,我尝试在你的package.json文件中将firebase版本修改为3.3.0,它在我这边工作得很好。请尝试按照我的步骤解决问题。

  1. 转到应用服务编辑器(预览版):

    转到门户,选择您的应用服务,单击应用服务编辑器(预览版),然后转到。

  2. 删除 node_modules 文件夹: 右键单击 WWWROOT 下的 node_modules 然后将其删除。

  3. 编辑package.json: 使用"firebase": "3.3.0" 而不是"firebase": "^3.5.2"

  4. 运行 npm 安装: 打开控制台然后运行以下命令:npm install –production

通过上述步骤,您将正确安装所有依赖项:

如有任何疑问,请随时告诉我。

【讨论】:

  • 嗨,加里,我按照您的步骤操作,但仍然遇到同样的错误。请参阅有问题的更新快照。我在 json lint 上验证了 package.json 文件,它是一个有效的 json。请查看我更新的 package.json 内容。
  • @VishalGulati 是app/dream/progress.ts(67,27): error TS1005: '(' expected. 引起的,你可以先修复一下。
  • package.json 很好。您可以仔细检查第 62 行中出现语法错误的 app/dream/progress.ts 文件。
  • @VishalGulati 看起来打字稿编译有问题。你能告诉我完整的堆栈跟踪吗?
  • @AaronChen 附上了部署错误的完整日志。
猜你喜欢
  • 1970-01-01
  • 2019-08-15
  • 1970-01-01
  • 2017-04-12
  • 2019-10-25
  • 2017-02-17
  • 2018-02-24
  • 2012-09-24
  • 1970-01-01
相关资源
最近更新 更多