Last active
September 21, 2020 15:53
-
-
Save javascripto/da206aa5d0ecc1de17d0bc5f388ce406 to your computer and use it in GitHub Desktop.
Instalação do nvm, npm e node na ultima versão
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| install_nvm_npm_and_node() { | |
| which curl | |
| if [ $? -eq 1 ]; then | |
| echo "curl is required to install nvm" | |
| exit 1 | |
| fi | |
| local SHELLRC="$HOME/.${0}rc" | |
| echo "Downloading nvm..." | |
| curl -s https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | $SHELL | |
| echo 'export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> $SHELLRC | |
| source $SHELLRC | |
| \. $HOME/.nvm/nvm.sh | |
| whereis nvm | |
| if [ $? -eq 0 ]; then | |
| nvm install $(nvm ls-remote | tail -n1) | |
| fi | |
| whereis npm | |
| if [ $? -eq 0 ]; then | |
| npm i -g npm | |
| fi | |
| whereis node | |
| if [ $? -eq 0 ]; then | |
| node -v && npm -v | |
| fi | |
| } | |
| install_nvm_npm_and_node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment