Skip to content

Instantly share code, notes, and snippets.

@DorkNstein
Last active March 24, 2017 14:31
Show Gist options
  • Save DorkNstein/b112b976a4ff1779d2d4cd2f9fad2c7f to your computer and use it in GitHub Desktop.
Save DorkNstein/b112b976a4ff1779d2d4cd2f9fad2c7f to your computer and use it in GitHub Desktop.
git clone git://github.com/creationix/nvm.git ~/.nvm
printf "\n\n# NVM\nif [ -s ~/.nvm/nvm.sh ]; then\n\tNVM_DIR=~/.nvm\n\tsource ~/.nvm/nvm.sh\nfi" >> ~/.bashrc
NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
# If nvm repo already exits
source ~/.nvm/nvm.sh
nvm ls-remote
nvm install vx.x.x
nvm alias default vx.x.x
## if sudo node -v & node -v gives different versions
nvm deactivate
which node # local node version path
sudo which node # sudo node version path
## if both nodes match
sudo npm cache clean -f
sudo npm install -g n
sudo n 4.x.x
## if they don't match
# overwrite sudo node bin path with local bin path
sudo rm -rf /bin/node ## replace `/bin/node` with result of `sudo which node`
sudo ln -s /usr/local/bin/node /bin/node ## replace `/usr/local/bin/node` with result of `which node`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment