NPM 安装在非本地的 VSTS 上失败

NPM install fails on VSTS not locally

我遇到了一个奇怪的问题,我没有更多的选择可以尝试,希望你能帮我一把 ;)

我有一个 angular-cli 项目,处理与 NPM 的依赖关系,以及在 VSTS 上为托管代理构建的一些任务。

问题出在几天前(在它工作正常之前),NPM INSTALL 命令不再起作用。我将附上所有信息,但首先,只想提一下,我已经尝试过的事情:

Package.json

{

  "name": "name",
  "version": "1.0.0",
  "description": "",
  "main": "src/app/main.ts",
  "scripts": {
    "build": "ng build",
    "start": "ng serve --host 0.0.0.0 --port 8080 --live-reload-port 49153",
    "dev": "ng build && npm start",
    "lint": "tslint --project tslint.json",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor",
    "postinstall": "gulp delete:types",
    "compile-ts": "node node_modules/typescript/lib/tsc.js -p ./tsconfig.json",
    "compile-sass": "gulp sass-compiler",
    "compile": "npm run compile-ts && npm run compile-sass",
    "clean": "gulp delete",
    "zip": "gulp zip"
  },
  "author": "Alejandro",
  "license": "MIT",
  "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",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.7",
    "angular-cli": "^1.0.0-beta.20-4",
    "animate.css": "^3.5.2",
    "bootstrap": "^4.0.0-alpha.4",
    "core-js": "^2.4.1",
    "font-awesome": "^4.6.3",
    "jquery": "^3.1.1",
    "ng2-pagination": "^0.5.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "signalr": "^2.2.1",
    "systemjs": "0.19.39",
    "underscore": "^1.8.3",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "codelyzer": "1.0.0-beta.1",
    "del": "^2.2.1",
    "gulp": "^3.9.1",
    "gulp-fail": "^1.0.5",
    "gulp-sass": "^2.3.2",
    "gulp-zip": "^3.0.2",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3",
    "typings": "^1.4.0"
  }
}

NPM 调试日志

(日志错误我认为重要的地方)

124543 verbose stack Error: node-sass@3.13.0 install: `node scripts/install.js`
124543 verbose stack Exit status 1
124543 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:239:16)
124543 verbose stack     at emitTwo (events.js:100:13)
124543 verbose stack     at EventEmitter.emit (events.js:185:7)
124543 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
124543 verbose stack     at emitTwo (events.js:100:13)
124543 verbose stack     at ChildProcess.emit (events.js:185:7)
124543 verbose stack     at maybeClose (internal/child_process.js:850:16)
124543 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
124544 verbose pkgid node-sass@3.13.0
124545 verbose cwd C:\a\s
124546 error Windows_NT 6.3.9600
124547 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
124548 error node v5.11.0
124549 error npm  v3.8.6
124550 error code ELIFECYCLE
124551 error node-sass@3.13.0 install: `node scripts/install.js`
124551 error Exit status 1
124552 error Failed at the node-sass@3.13.0 install script 'node scripts/install.js'.

整个npm调试文件比较重,但如果你觉得有帮助,我会以文件的形式上传到另一台服务器以便下载。

最后,让我再说一遍,直到几天前它还在工作,我更改了我的依赖项以添加测试工具(jasmine,karma,protactor ...)然后它停止工作,现在甚至删除它们,还是坏了。在本地,它在我的机器和另一台以前从未打开过项目的机器上工作(这意味着我在本地没有任何东西可以使项目只在我的环境中工作)

最后 2,失败的命令是 NPM INSTALL,如果我修复了那个,其余步骤应该没问题

提前感谢您的宝贵时间,非常感谢。

我在查看 VSTS 历史记录后发现了问题,检查差异并一一删除库,看看是什么破坏了 VSTS 上的构建,而不是本地。

它是 4.0.9 版本中的 protactor,它负责将构建与一些子依赖关系搞乱。我将向他们的团队报告它只是为了让他们现在可以使用未来的版本。

希望这会对外面的人有所帮助:)

Protactor 存储库问题:here