2017-06-14 64 views
0

我目前使用npm install爲Angular2項目CI項目安裝所有軟件包,但是此步驟已開始增加構建代理構建項目所需的時間。我想通過使用npm-cache命令獲得CI管道的構建運行時間,但是我一直嘗試通過構建代理運行命令失敗。使用npm-cache VS Team Services的正確方法

我已經使用命令行步具有以下嘗試:

enter image description here

這一結果在錯誤File name doesn't indicate a full path to a executable file

我也已嘗試加入NPM步驟:

enter image description here

這導致以下:

2017-06-14T13:01:13.2274922Z [命令] C:\ Program Files \ nodejs \ npm.cmd緩存安裝

2017-06-14T13:01:19.8609829Z npm ERR!用法:npm cache添加tarball文件

2017-06-14T13:01:19.8630626Z npm ERR! npm cache add folder

2017-06-14T13:01:19.8630626Z npm ERR! npm cache add tarball url

2017-06-14T13:01:19.8640981Z npm ERR! npm cache add git url

2017-06-14T13:01:19.8651863Z npm ERR! npm cache add name @ version

2017-06-14T13:01:19.8661607Z npm ERR! npm cache ls path

2017-06-14T13:01:19.8672137Z npm ERR! npm cache clean pkg @版本

什麼是從Team Services中調用npm cache的正確方法?

+0

您是否使用自己的代理或託管代理? –

+0

我們使用的是本地代理 – Novastorm

回答

1

您需要先安裝npm-cache軟件包,然後通過命令行任務調用npm-cache命令。

  1. 添加NPM任務(NPM命令:安裝;參數:NPM-緩存-g)
  2. 添加命令行任務(工具:C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm\\npm-cache;參數:install;工作文件夾:$(Build.SourcesDirectory)

節點:以前的步驟使用專用構建代理作爲服務運行NetworkService帳戶。您可以將C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm添加到系統環境變量(需要重新啓動計算機)並直接調用npm-cache命令。

你也可以改變生成代理帳戶使用您的帳戶(默認情況C:\Users\[user name]\AppData\Roaming\npm已添加到用戶環境變量),然後調用NPM-緩存命令安裝NPM-緩存-g爭吵後)

另一方面,宿主代理不會緩存包,所以如果您使用的是託管代理程序,它將毫無用處。

+0

我真的不能完全感謝你,遵循以下步驟,我設法讓npm-cache工作,現在可以降至100秒而不是6分鐘 - 謝謝! – Novastorm

相關問題