How to set Node.js and NPM version numbers in a hosted VSO Build Agent?

荒凉一梦 提交于 2019-12-07 02:50:47

问题


In Visual Studio Online you can now set build dependencies on the General tab of a build definition.

But.. is there a way to set the version of Node.js and NPM?

It seems like a hosted build agent is currently using Node.js v0.12.7 and NPM v2.11.3 but I need Node.js v4.2+ and NPM v3.3+. Is there a way to enforce it?

P.S.: On-premise VSO build agent is not an option.


回答1:


There is now a Node Tool installer available. The link to software inventory shared by Daniel was very helpful, and I discovered the installer digging into the Node specs for Hosted VS2017 agent.

Finds or downloads and caches the specified version of Node.js and adds it to the PATH

Try adding a Node Tool installer step before your node/npm steps.




回答2:


It seems like there's a lot of misunderstanding as to what "demands" are. A build with a specific demand does not change what software is available on the build agent. A "demand" is simply a method of a build task expressing what requirements it has, so it can run on an agent that has the desired demands satisfied (these are the build agent's "capabilities").

This list of software is what's on the hosted build agent. If it's not there, and you can't install it via npm or the like, then you're out of luck.



来源:https://stackoverflow.com/questions/33150823/how-to-set-node-js-and-npm-version-numbers-in-a-hosted-vso-build-agent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!