We're using this code to add NodeJS via NVM. The value that we have in DEFAULT_NODEJS_VERSION is 6.
def addNVM(def nvmversion=DEFAULT_NODEJS_VERSION){
this.job.with {
configure { project ->
project / buildWrappers << 'org.jenkinsci.plugins.nvm.NvmWrapper' {
version(nvmversion)
}
}
}
return this
}
When NodeJS version 6 is installed, the default npm version that is installed is 3.10.x. Unfortunately, we need npm version 5 or higher. Is there a way to also upgrade npm to 5 or higher using the code above?
We don't want to tell our hundreds of users to add an "Execute Shell" to run "npm install -g npm@latest" since we have thousand of jobs. However, if it can be done in the groovy since we build our jenkins slave from time to time, that would be awesome.
Thanks!
Neil