Skip to content

Instantly share code, notes, and snippets.

@CreatiCoding
Last active May 18, 2019 07:07
Show Gist options
  • Save CreatiCoding/e80b348936eb11d99054a62eca4e9253 to your computer and use it in GitHub Desktop.
Save CreatiCoding/e80b348936eb11d99054a62eca4e9253 to your computer and use it in GitHub Desktop.
[bash] install node 10 in ubuntu including about auth for npm directory.
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
OUTPUT="$(npm config get prefix)"
echo "$OUTPUT"
if [ "$OUTPUT" == "/usr/local" ]; then
OUTPUT="$(sudo chown -R $USER /usr/local)"
else
OUTPUT="$(mkdir ~/npm-global-modules)"
OUTPUT="$(npm config set prefix '~/npm-global-modules')"
OUTPUT="$(echo 'export PATH=~/npm-global-modules/bin:\'$PATH >> ~/.profile )"
OUTPUT="$(source ~/.profile)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment