Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eculver/661852 to your computer and use it in GitHub Desktop.
Save eculver/661852 to your computer and use it in GitHub Desktop.
npm + node install
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
./configure --prefix=~/local
make install
curl http://npmjs.org/install.sh | sh
# this way is really handy if you want to test things
# in different versions of node and use stable release
# versions of things.
# make a folder where you want to keep this stuff.
mkdir my-happy-node-stuff
cd my-happy-node-stuff
wget http://github.com/isaacs/nave/raw/master/nave.sh
sudo ln -s $PWD/nave.sh /usr/local/bin/nave
# now you can forget about that folder.
# you never have to go back in there.
# to use a version of node in a virtual environment
nave use 0.2.3
# to install npm in that virtualenv
curl http://npmjs.org/install.sh | sh
# do stuff...
npm install whatever etc
# return to non-nave-land
exit
# use a different version of node..
nave use 0.2.1
# etc...
echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
echo 'export npm_config_userconfig=$HOME/.config/npmrc' >> ~/.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
./configure --prefix=~/.local
make install
curl http://npmjs.org/install.sh | sh
# install node wherever...
cat <<NPMRC >>$HOME/.npmrc
root = ~/.node_libraries
manroot = ~/local/share/man
binroot = ~/bin
NPMRC
curl http://npmjs.org/install.sh | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment