3

Like a lot of people I am also having issues with Yeoman. Error -bash: yo: command not found in OSx.

I tried adding export PATH=/usr/local/share/npm/bin:$PATH on my .bash_profile as suggested by some folks and still same error.

I've lost 2 hours of my productivity trying to fix Yeoman bugs and still nothing.

Does anyone know any good solution that fixes the -bash: yo: command not found ?

brunodd
  • 2,474
  • 10
  • 43
  • 66

5 Answers5

13

I found that for recent versions of npm, all node packages are installed in the ~/npm/bin/ directory.

So add those lines to your $PATH in the .profile file :

export PATH=$PATH:~/npm/bin

Then do :

source ~/.profile
yo -v
fgirardey
  • 151
  • 7
4

Finally found a solution for this.

First I had to uninstall and install yo again:

npm remove -g yo
npm install -g yo

I also added a symlink to the bash_profile to make yo work. The following line: PATH=${PATH}:~/.node/bin After that restart the prompt for the change to take action.

Please check this for more references: Why are my Yeoman generators installing in the wrong place?

Community
  • 1
  • 1
brunodd
  • 2,474
  • 10
  • 43
  • 66
0

try to add an symbolic-link (ln -s) into the /sbin -directory. like:

ln -s /sbin/ /usr/local/share/npm/bin/yo
InvAdErZz
  • 49
  • 1
  • 11
  • Thanks for replying back mate. This is what I am getting: ln: /usr/local/share/npm/bin/yo: No such file or directory – brunodd Mar 21 '15 at 12:00
  • Is there an /usr/local/share/npm/sbin directory ? Look if there is an file named "yo" and if so try to softlink this file. – InvAdErZz Mar 21 '15 at 12:07
  • Thanks mate. I did what you suggested followed by the reinstallation of yo and that worked. – brunodd Mar 21 '15 at 12:15
0

This also seems to work :)

sudo `yo angular2-ts [appname]`

where [appname] is the name of your app (without the []) :)

ACV
  • 9,964
  • 5
  • 76
  • 81
0

just give access for the user to read write execute in the folder webapp

sudo chmod 777 webapp
cd webapp
yo angular [appname]