Skip to content

Instantly share code, notes, and snippets.

@theprojectsomething
Last active August 2, 2017 08:57
Show Gist options
  • Save theprojectsomething/664c13d6fa5cae02d7e1369bd0abbaf9 to your computer and use it in GitHub Desktop.
Save theprojectsomething/664c13d6fa5cae02d7e1369bd0abbaf9 to your computer and use it in GitHub Desktop.
Installing Node + NPM (the right way)

Installing Node + NPM (the right way)

Follow the steps below to get Node and NPM running cleanly on your machine.

1. Uninstall Node + NPM

npm uninstall npm -g
rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
rm -rf /usr/local/include/node /Users/$USER/.npm
rm /usr/local/bin/node
rm /usr/local/share/man/man1/node.1
rm /usr/local/lib/dtrace/node.d

2. Install NVM (node version manager)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

3. Check your ~/.bash_profile includes the following (if not paste it in):

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

4. Install Node + Updated NPM:

nvm install stable
nvm use --delete-prefix stable
nvm alias default stable
npm install npm -g
echo node: $(node -v) npm: $(npm -v)
# you're done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment