Reputation: 1458
I'm currently using npm install
to install all packages for an Angular2 project CI project, however this step has started to increase the time it takes build agents to build the project. I would like to get build run times down for our CI pipeline by using the npm-cache
command, however I keep getting failed attempts at running the command through the build agent.
I have tried using a Command Line step with the following:
This result in the error File name doesn't indicate a full path to a executable file
.
I have also tried added an npm step:
Which results in the following:
2017-06-14T13:01:13.2274922Z [command]C:\Program Files\nodejs\npm.cmd cache install
2017-06-14T13:01:19.8609829Z npm ERR! Usage: npm cache add tarball file
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@version
What is the correct way to call npm cache
from Team Services?
Upvotes: 0
Views: 1829
Reputation: 33708
You need to install npm-cache package first, then call npm-cache command via command line task.
C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm\\npm-cache
; Arguments:install
; Working folder: $(Build.SourcesDirectory)
)Node: Previous steps uses the private build agent that running as service with NetworkService account. You can add C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm
to system environment variable (restart machine is needed) and call npm-cache command directly.
You also can change build agent account to use your account (by default C:\Users\[user name]\AppData\Roaming\npm
has added to user environment variable), then call npm-cache command after install npm-cache package with -g argument)
On the other hand, host agent won’t cache the packages, so it is useless if you are using hosted agent.
Upvotes: 4