Last active
August 24, 2017 14:56
-
-
Save hedcler/97858b2dbdf5384fbcaec5539697d10f to your computer and use it in GitHub Desktop.
Install npm globally without sudo
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/sh | |
# No need to download this script, just run it on your terminal: | |
# | |
# $ curl -L git.io/v5qOi | sh | |
# | |
mkdir "${HOME}/.npm-packages" | |
echo "prefix=${HOME}/.npm-packages" >> ~/.npmrc | |
echo "# RUN NPM WITHOUT SUDO" >> ~/.bashrc | |
echo "NPM_PACKAGES=\"${HOME}/.npm-packages\"" >> ~/.bashrc | |
echo "export NPM_PACKAGES" >> ~/.bashrc | |
echo "PATH=\"$NPM_PACKAGES/bin:$PATH\"" >> ~/.bashrc | |
echo "export PATH" >> ~/.bashrc | |
echo "unset MANPATH" >> ~/.bashrc | |
echo "export MANPATH=\"$NPM_PACKAGES/share/man:$(manpath)\"" >> ~/.bashrc | |
sudo chown -R $(whoami) /usr/local/ | |
source ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment