In the beginning, I had yo
and generator-angular
installed on /usr/local/lib/node_modules
(by doing the bad sudo npm install -g ...
).
Then I read isaccs' advice on how to make npm and yo work without sudo, and modified his steps to make all the lines work. So I got yo
and generator-angular
installed on ~/.node/lib/node_modules
as well.
Finally, suspecting that yo
might be running from the original directory, I removed /usr/local/lib/node_modules
. I created a brand new directory in "~/" and called yo angular
in it, but was faced with: yo: command not found
.
Is there a command that tells me from which directory yo
is running from?
How can I tell yo
that it should run from ~/.node/lib/node_modules
?
More info:
My $PATH
: /home/ubuntu/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
My ~/.bashrc
contains export PATH=$HOME/local/bin:$PATH
My ~/.npmrc
contains prefix = /home/ubuntu/.node
$ ls -l ~/.node/lib/node_modules/
total 24
drwxr-xr-x 7 nobody ubuntu 4096 Feb 17 21:57 bower
drwxr-xr-x 19 nobody ubuntu 4096 Feb 22 01:19 generator-angular
drwxr-xr-x 4 nobody ubuntu 4096 Feb 17 22:00 generator-karma
drwxr-xr-x 6 nobody ubuntu 4096 Feb 17 21:57 grunt-cli
drwxr-xr-x 10 nobody ubuntu 4096 Feb 17 23:15 npm
drwxr-xr-x 4 nobody ubuntu 4096 Feb 17 22:00 yo
1.Install nvm:
$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh
2.Use nvm to install node and npm. Reopen your terminal and run the following commands in turn:
$ nvm install 0.10.26
$ npm install -g yo
$ npm install -g generator-angular
yo
and generator-angular
will be installed in ~/.nvm/v0.10.26/lib/node_modules
. You can run them directly in the terminal now:
$ yo -v
3.Run which yo
to find the directory yo
is running from.