I'm trying to provision a vagrant development server to start up with Node Version Manager. This is so I can quickly change between versions of node while in development.
The code I'm using - while it does work when entered manually - doesn't work with the Salt Config that I'm using. The manual installation instructions that I'm following are outlined here:
https://github.com/creationix/nvm
Here is the code in my nvm/init.sls:
nvm:
cmd:
- cwd: /tmp
- names:
- . ~/.nvm/nvm.sh
- run
- require:
- pkg: git
# Use NVM to obtain latest node versions and choose one to use.
node:
cmd:
- names:
- nvm install 0.80
- nvm install 0.11
- nvm install 0.10
- nvm use 0.10
- run
- require:
- cmd: nvm
And here are the relevant return messages:
State: - cmd
Function: run
Result: True
Changes: pid: 4959
retcode: 0
stderr:
stdout: => NVM is already installed in /root/.nvm, trying to update
=>
Already up-to-date.
=> Source string already in /root/.profile
=> Close and reopen your terminal to start using NVM
----------
State: - cmd
Name: nvm install 0.10
Function: run
Result: False
Comment: Command "nvm install 0.10" run
Changes: pid: 4990
retcode: 127
stderr: /bin/bash: nvm: command not found
stdout:
----------
State: - cmd
Name: nvm install 0.11
Function: run
Result: False
Comment: Command "nvm install 0.11" run
Changes: pid: 4991
retcode: 127
stderr: /bin/bash: nvm: command not found
stdout:
----------
State: - cmd
Name: nvm install 0.80
Function: run
Result: False
Comment: Command "nvm install 0.80" run
Changes: pid: 4992
retcode: 127
stderr: /bin/bash: nvm: command not found
stdout:
----------
State: - cmd
Name: nvm use 0.10
Function: run
Result: False
Comment: Command "nvm use 0.10" run
Changes: pid: 4993
retcode: 127
stderr: /bin/bash: nvm: command not found
stdout:
----------
I think it's to do with the fact that the installation is performed by root and perhaps there's something that happens when trying to source ~/.nvm/nvm.sh with this code.
Does anyone have any ideas which direction I could go?
I'd love to have an installation of nvm available for all users (which I can specify via pillars) as well as root. For now I'd be happy with a basic installation running for the vagrant user.
Thanks