public

npm + node install

  • Download Gist
node-and-npm-in-30-seconds.sh
Shell
1 2 3 4 5 6 7 8 9
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
use-nave.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 
# 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...
xgd-freedesktop.org-style.sh
Shell
1 2 3 4 5 6 7 8 9 10
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
yet-another-option.sh
Shell
1 2 3 4 5 6 7
# install node wherever...
cat <<NPMRC >>$HOME/.npmrc
root = ~/.node_libraries
manroot = ~/local/share/man
binroot = ~/bin
NPMRC
curl http://npmjs.org/install.sh | sh

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.