-
-
Save isaacs/579814 to your computer and use it in GitHub Desktop.
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 # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
# 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 |
# 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 |
# 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 |
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 |
# 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 |
You may want to change the npm install url to: https://www.npmjs.com/install.sh
from here: https://gist.github.com/isaacs/579814#file-node-and-npm-in-30-seconds-sh-L9
And to update @eltrhn 's comment, the npm github repository link should now read git://github.com/npm/cli.git
cd npm
will thus also need changing to cd cli
.
Thanks you for compiling this, it helped!
yet-another-option.sh needs the -L option for curl now.
echo prefix = ~/local >> ~/.npmrc
curl -L https://www.npmjs.org/install.sh | s
@dreaddymck The correct command would be ...
curl -L https://www.npmjs.org/install.sh | sh
Method one works fine on Debian Stretch. Really helpful !!!
After I got PhpStorm problem : Failed to run File Watcher 'Sass'. The watcher has been disabled.
So I needed to do :
ln -s /home/yourname/local/bin/node /usr/bin/node
Still working @sethbergman - cheers!
Any suggestions, followed method 1 and all successful until the end of the make process: ./deps/zlib/deflate.c:54:10: fatal error: 'contrib/optimizations/insert_string.h' file not found. Any suggestions? Had been running for 30+ mins prior to the error.
Below are the simple steps to proceed with the installation
Open Terminal
Run command to install nodejs : sudo apt install nodejs
Run command to verify installation by checking version: node -v or node –version
Run command to install npm: sudo apt install npm
Run command to verify installation of npm: npm -v or npm –version
For reference: https://youtu.be/DGjfw4y0nTI
I am using the first method for installation in a ruby docker image ,and it finally throws error.Tried many approach doesn’t seems to work,if someone can guide me how to install it inside a ruby docker image,thanks
How do I uninstall if I installed with the 1st way?
node-and-npm-in-30-seconds.sh
CentOS 7