Skip to content

Instantly share code, notes, and snippets.

@ulfryk
Forked from isaacs/node-and-npm-in-30-seconds.sh
Last active September 9, 2015 06:06
Show Gist options
  • Save ulfryk/0d64793f3aded854b2d2 to your computer and use it in GitHub Desktop.
Save ulfryk/0d64793f3aded854b2d2 to your computer and use it in GitHub Desktop.
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
# commented out version belo does not work for OS X
# ./configure --prefix=~/local
./configure --prefix=/Users/YourUserNameHere/local
make install # ok, fine, this step probably takes more than 30 seconds...
# commented out version belo does not work for OS X
# curl https://www.npmjs.org/install.sh | sh
curl -O -L https://npmjs.org/install.sh
sh install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment