Using nvm in build shell script causes 'No such file or directory' error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using nvm in build shell script causes 'No such file or directory' error

Martin Baillie
Hi,

I'm using Jenkins to build a Cordova project. 

Recently I've upgraded the Jenkins server (a MacMini running Mojave) from a standard node install to use NVM.

I'd like to call nvm from within the build script I call from Jenkins' Build > Execute Shell option.

However when I reference nvm from within the script (see below examples) I get the error 'No such file or directory'.

nvm use

or

. ~/.nvm/nvm.sh

nvm
use

or

source /path/to/.nvm/nvm.sh

nvm
use

I can run the script directly from the server's terminal with no error, NVM is sourced within ~/.profile, .profile is sourced within ~/.bashrc and .bashrc is sourced within ~/.bash_profile.

I am aware of the NVMWrapper plugin, but am avoiding that for the time being due to not being certain it will work with my current version of Jenkins and I'd rather not break Jenkins as our resident Jenkins expert is currently unavailable.







--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8327acbe-4806-46c0-836a-36b72f60e82ao%40googlegroups.com.