Forked from isaacs/node-and-npm-in-30-seconds.sh
Last active
August 29, 2015 14:04
-
-
Save jasdeepkhalsa/cf9773b1f0edf0a9ba18 to your computer and use it in GitHub Desktop.
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
#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=$HOME/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.com/install.sh | sh | |
echo "Installed Node and NPM!" | |
wait | |
rm -r ~/node-latest-install # cleanup | |
echo "Finished cleanup" |
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
# this way is best if you want to stay up to date | |
# or submit patches to node or npm | |
mkdir ~/local | |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
# could also fork, and then clone your own fork instead of the official one | |
git clone git://github.com/joyent/node.git | |
cd node | |
./configure --prefix=~/local | |
make install | |
cd .. | |
git clone git://github.com/isaacs/npm.git | |
cd npm | |
make install # or `make link` for bleeding edge |
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
# take ownership of the folders that npm/node use | |
# please don't do this if you don't know what it does! | |
sudo mkdir -p /usr/local/{share/man,bin,lib/node,include/node} | |
sudo chown -R $USER /usr/local/{share/man,bin,lib/node,include/node} | |
# now just a pretty vanilla node install | |
# let it use the default paths, but don't use sudo, since there's no need | |
mkdir node-install | |
curl http://nodejs.org/dist/node-v0.4.3.tar.gz | tar -xzf - -C node-install | |
cd node-install/* | |
./configure | |
make install | |
# now the npm easy-install | |
curl https://www.npmjs.org/install.sh | sh |
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
# using Homebrew | |
# Note: `brew install npm` has problems, as of 2010-12-30. | |
# hopefully it will eventually be good and happy. | |
# As of [email protected], however, this is an option | |
PREFIX=$(brew --prefix) | |
# take ownership | |
# this will also let homebrew work without using sudo | |
# please don't do this if you don't know what it does! | |
sudo mkdir -p $PREFIX/{share/man,bin,lib/node,include/node} | |
sudo chown -R $USER $PREFIX/{share/man,bin,lib/node,include/node} | |
brew install node | |
# now install npm | |
# prefix will default to $(brew --prefix) | |
curl https://www.npmjs.org/install.sh | sh |
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
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 https://www.npmjs.org/install.sh | sh |
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
# install node wherever. | |
# use sudo even, it doesn't matter | |
# we're telling npm to install in a different place. | |
echo prefix = ~/local >> ~/.npmrc | |
curl https://www.npmjs.org/install.sh | sh |
I have also commented out the first two lines, because my .bashrc
files already contains these
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first script was updated because the destination of
npm
changed and the path to Node changed