Last active
April 10, 2020 03:49
-
-
Save zetekla/7cc84ef24a65aaf3a29de0fbd37b08cb to your computer and use it in GitHub Desktop.
JohnPapa to install npm properly with homebrew
This file contains 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
NPM_PACKAGES=/Users/admin/.npm-packages | |
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" | |
PATH="$NPM_PACKAGES/bin:$PATH" |
This file contains 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
https://www.microsoft.com/net/learn/get-started/macos | |
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/ |
This file contains 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
# NOT RECOMMEND, use THE NPM.TXT | |
# brew install node --without-npm | |
brew install node | |
mkdir "${HOME}/.npm-packages" | |
echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc | |
echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc | |
# curl -L https://www.npmjs.org/install.sh | sh | |
echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc | |
echo PATH=\"\$NPM_PACKAGES/bin:\$PATH\" >> ${HOME}/.bashrc | |
echo source "~/.bashrc" >> ${HOME}/.bash_profile | |
source ~/.bashrc |
This file contains 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
#Executive summary: | |
brew install node | |
mkdir "${HOME}/.npm-packages" | |
echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc | |
echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc | |
echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc | |
echo PATH=\"\$NPM_PACKAGES/bin:\$PATH\" >> ${HOME}/.bashrc | |
echo source "~/.bashrc" >> ${HOME}/.bash_profile | |
source ~/.bashrc |
This file contains 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
NVM is very helpful to manage multiple Node versions in your local env | |
Installation | |
https://www.wdiaz.org/how-to-install-nvm-with-homebrew/ | |
brew install nvm | |
mkdir ~/.nvm | |
nvm install --lts | |
nvm use node | |
nvm run node --version | |
REMEMBER TO UPDATE .bash_profile | |
Add the following to ~/.bash_profile or your desired shell | |
configuration file: | |
export NVM_DIR="$HOME/.nvm" | |
. "/usr/local/opt/nvm/nvm.sh" | |
--- | |
Remove nodejs and npm completely: | |
https://www.hungred.com/how-to/completely-removing-nodejs-npm/ | |
If nodejs and npm were installed through HomeBrew, following the executive commands below: | |
brew uninstall node; | |
# or `brew uninstall --force node` which removes all versions | |
brew cleanup; | |
rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d; | |
rm -rf ~/.npm; | |
Remove nvm completely: | |
1/ Run these 3 cli: | |
rm -rf ~/.nvm | |
rm -rf ~/.npm | |
rm -rf ~/.bower | |
2/ nvm unload OR nvm deactivate | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MongoDB: https://gist.github.com/nrollr/9f523ae17ecdbb50311980503409aeb3