Took the plunge a couple of days ago, using yeoman for a project. After some fiddling I got it to work on my computer, but then something got messed up and now the project is not running anymore. I think the issue has to do with yeoman installing in one place, but the system looking for it in another. I think, but obviously, I don't exactly know where things are going wrong.
I think the two locations are:
Users/brian/
usr/local/lib
usr/local/bin
I am not sure where things should be installing for Yeoman. I realize that initially, I was using sudo to install things and that might have messed some thing up, or that I was using homebrew. I have since uninstalled homebrew and no longer need to use sudo for nom to install stuff.
$ node -v
v0.10.22
$ npm -v
1.3.14
$ echo $NODE_PATH
returns nothing.
$ echo $PATH
/Users/brian/.rvm/gems/ruby-2.0.0-p0/bin:/Users/brian/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/brian/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/brian/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
$ which npm
returns /usr/local/bin/npm
$ npm install -g yo
Seems to install fine, at the end it says:
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/bin/yo
yo@1.0.5 /usr/local/lib/node_modules/yo
but if you run yo -v after it says: env: node\r: No such file or directory
If I run:
sudo nano /etc/paths
it shows the following paths, of which I added the last path:
/usr/bin
/bin
/usr/sbins
/usr/local/bin
/usr/local/bin/npm
I have node_modules folders in a number of places.
Users/brian/node_modules
usr/local/lib/node_modules
and a number of other places.
Where are things going wrong? Where should npm install yeoman stuff and how does the system refer to it, so it know where it is when I write stuff like $ yo -v
Thanks a lot for any help with this.
Thank you!
Thanks to Bartvds (https://github.com/yeoman/yeoman/issues/1236)
The reason for this issue is because of the difference in end of line terminators between windows and *nix machines.
The CLI files with shebang when calling node, this end of line terminators are causing issue.
You can convert the files with this shebang to *nix friendly format using dos2unix utility and it should work fine
This problem is not specific to yeoman alone! I recently encountered the same with interfake node package
There was an issue with the
1.0.5
launch ofyo
. Try some solutions from other users. Basically:I ran into the same problem after I changed the default directory for global node installs. And here's I fixed this:
From terminal type:
In your case the path would look like (or something similar)
Now all you need to do is to add this path
/Users/brian/npm/bin/
to the$PATH
variable in your.bash_profile
file. Then logout and log back in and typeyo
.