Skip to content

Instantly share code, notes, and snippets.

@randwa1k
Forked from isaacs/node-and-npm-in-30-seconds.sh
Last active August 29, 2015 13:56
Show Gist options
  • Save randwa1k/9165923 to your computer and use it in GitHub Desktop.
Save randwa1k/9165923 to your computer and use it in GitHub Desktop.
# install node wherever.
# use sudo even, it doesn't matter
# we're telling npm to install in a different place.
#for youtube_12
echo prefix = ~/local >> ~/.npmrc
# curl https://npmjs.org/install.sh | sh
# use this below instead to avoid install.sh newline error
curl -O https://www.npmjs.org/install.sh
# avoid this error: find: `/usr/local/lib/node': No such file or directory
#sudo mkdir -p /usr/local/{lib/node,include/node}
mkdir local
sudo sh install.sh
echo "export NODE_PATH=$NODE_PATH:/home/ubuntu/local/lib/node_modules" >> ~/.bashrc && source ~/.bashrc
---
npm cache clean
/*
$ echo $PATH
/home/ubuntu/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
$ which yo
/home/ubuntu/local/bin/yo
~/local/lib/node_modules$ ls -alt
total 32
drwxrwxr-x 4 ubuntu ubuntu 4096 Feb 23 00:11 generator-karma
drwxrwxr-x 8 ubuntu ubuntu 4096 Feb 23 00:11 .
drwxrwxr-x 19 ubuntu ubuntu 4096 Feb 23 00:11 generator-angular
drwxrwxr-x 7 ubuntu ubuntu 4096 Feb 22 23:47 bower
drwxrwxr-x 6 ubuntu ubuntu 4096 Feb 22 23:47 grunt-cli
drwxrwxr-x 4 ubuntu ubuntu 4096 Feb 22 23:44 yo
drwxrwxr-x 9 ubuntu ubuntu 4096 Feb 17 22:52 npm
drwxrwxr-x 4 ubuntu ubuntu 4096 Feb 17 22:52 ..
~/.node/lib/node_modules$ ls -alt
total 32
drwxr-xr-x 19 nobody ubuntu 4096 Feb 22 01:19 generator-angular
drwxr-xr-x 8 nobody ubuntu 4096 Feb 22 01:19 .
drwxr-xr-x 10 nobody ubuntu 4096 Feb 17 23:15 npm
drwxr-xr-x 4 nobody ubuntu 4096 Feb 17 22:00 yo
drwxr-xr-x 4 nobody ubuntu 4096 Feb 17 22:00 generator-karma
drwxr-xr-x 7 nobody ubuntu 4096 Feb 17 21:57 bower
drwxr-xr-x 6 nobody ubuntu 4096 Feb 17 21:57 grunt-cli
drwxr-xr-x 3 root root 4096 Feb 17 21:55 ..
~/.nvm/v0.10.26/lib/node_modules$ ls -alt
total 12
drwxr-xr-x 3 ubuntu ubuntu 4096 Feb 18 23:44 .
drwxr-xr-x 4 ubuntu ubuntu 4096 Feb 18 23:44 ..
drwxr-xr-x 9 ubuntu ubuntu 4096 Feb 18 23:44 npm
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment