Yeoman | yo command not found
Asked Answered
M

14

26

Saw that there were some similar questions as this one but didn't find the answers satisfying enough or applicable to my problem so thought I'd thought I'd ask one more time.

i'm having trouble with the "$ yo" command and that my cmd keeps telling me that the command is not found.

i've installed yeoman through:

$npm install -g yo

without any problems. I've also checked my $PATH under

$ echo $PATH
/c/Users/Anton/bin:.:/usr/local/bin:/mingw/bin:/bin:.:/c/Program Files (x86)/Java/jre7/bin:/usr/cmd:/usr/bin:/c/Program Files (x86)/nodejs/:/c/Users/Anton/AppData/Roaming/npm

and confirmed that yo is installed together with other node modules. I'm able to call other commands such as:

$ bower

Usage:

bower <command> [<ar.....

and

$ yeoman
==========================================================================
We're constantly looking for ways to make yeoman better!
May we anonymously report .....

with out any problems. While yo results in failure

$ yo
sh.exe": yo: command not found

Does anyone have any suggestions of what's wrong? I've read that ther might be something wrong with the $PATH? Can I reset it in any way?

(OS: Windows 8.1 | Node v0.10.29)

Misunderstanding answered 1/7, 2014 at 13:3 Comment(6)
You are using cygwin shell, not cmd. Type exit and try in cmd.Haematinic
Thanks, tried CMD now. Re-installed everything and tried 'yo' once again. This time with the result: "'yo' is not recognized as an internal or external command, operable program or batch file."Misunderstanding
When a program edits the PATH, the command prompt lust be restarted. Try itHaematinic
If the install was successful, then it's most likely a path issue. But you need to find where it's installed to verify that. Try running npm ls -g yo to see where it's installed.Herc
Thanks guys, I think you made it! (Y)Misunderstanding
@Haematinic this was exactly the issue for me, many thanks!Rue
W
44

Try adding this to your user path:

C:\Users\myusername\AppData\Roaming\npm

Then, restart the console.

Workwoman answered 1/12, 2014 at 8:17 Comment(2)
How/where do you add that to a user path?Lindo
You should be able to just add %APPDATA%\npm.Descartes
A
7

Add this to PATH:

C:\Users\<myusername>\AppData\Roaming\npm

and be sure 2 things:

  • myusername is correct.
  • restart console and test by :

    echo $PATH 
    

i just fixed the same issue on my windows, $PATH should be updated on system PATH to avoid user PATH to override.

Adorn answered 16/2, 2015 at 10:49 Comment(1)
You could replace C:\Users\<myusername> with %USERPROFILE%, or, even better, replace %USERPROFILE%\AppData\Roaming with %APPDATA%. Add directories to PATH by searching from the Windows 10 start menu: "Edit environment variables for your account" or "Edit the system environment variables".Mande
C
5

In windows run this in command prompt:

IF EXIST C:\Users\username\AppData\Roaming\npm SET PATH=%PATH%;C:\Users\username\AppData\Roaming\npm
Carlsbad answered 21/2, 2015 at 5:25 Comment(2)
Doesn't get saved, when I close the CMD and check echo %path% it is gone.Timi
Yes it will not be saved it will work in that "session"Carlsbad
D
3

I also tried to add C:\Users\myusername\AppData\Roaming\npm, uninstalling, reinstalling yo globally,and restarted console but still prints out yo:command not found. I check the files manually and I found out that it doesn't not create Windows Command Script. I'm not sure if this related to that but maybe it may help to find solution for this issue. My OS: Windows 8.1

enter image description here

Dissatisfied answered 8/1, 2016 at 13:59 Comment(1)
Check the path C:\usr\localCamshaft
S
1

For me yo was installed in C:\Program Files (x86)\Git\local

After I added C:\Program Files (x86)\Git\local in Path, it worked

After you install yeoman, check the directory it is installed on and add that directory to path

Scratch answered 13/7, 2016 at 6:48 Comment(0)
R
1

For me I added this:C:\usr\local to the PATH, and it worked like a charm!

Righthanded answered 15/3, 2017 at 22:13 Comment(0)
M
1

Run the following command :

C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat"

This will start node command prompt. Please note that SPFx is currently supported at node version 8 ( https://nodejs.org/dist/v8.11.4 )

Monnet answered 25/2, 2019 at 13:56 Comment(0)
M
0

Please try this command:

$ sudo npm install -g yo

Mckean answered 9/10, 2014 at 15:37 Comment(2)
his trying to install it in windows not in linux.Hetaerism
This is useful for people who come to this question who need 'yo' installed on a Mac.Slavism
P
0

I solve it by:

  1. Update the patch which normally located at C:\Users<myusername>\AppData\Roaming\npm
  2. Open CMD as administrator.
Pickering answered 5/5, 2017 at 21:37 Comment(0)
V
0

Try these (Worked for me in Mac)

1.  export PATH="$PATH":~/.node/bin

2.  npm config set prefix ~/npm

3.  echo "export NODE_PATH=$NODE_PATH:/home/$USERNAME/npm/lib/node_modules" >> ~/.bashrc && source ~/.bashrc
Valenevalenka answered 9/7, 2017 at 19:30 Comment(0)
P
0

i was getting yo: command not found after successfully installing yeoman on my Windows machine. i was able to fix this by replacing "yo" with the following /c/Users/daclar.CLARKE-BOOK/AppData/Roaming/npm/yo

i got that Path from finding Yeman files on my machine and copying the file path

this allowed me to continue with my Yo commands form Git Bash so instead of doing...

 $ yo hubot --adapter="slack"

i did..

 $ /c/Users/daclar.CLARKE-BOOK/AppData/Roaming/npm/yo hubot --adapter="slack"
Porthole answered 28/9, 2017 at 19:47 Comment(0)
C
0

You have to add the path where yo is installed. You can check that by giving the following command.

npm config get prefix. you should get a location. Navigate to the location and see if yo is installed at the location.

for me, the location was C:\usr\local. So I added the same to environment variables and done.

Camshaft answered 28/1, 2019 at 6:57 Comment(0)
H
0

In Windows, just install the Yeoman Generator globally by,

One Line Install npm install -g yo

and then add the following path in you system variables,

C:\Users\myusername\AppData\Roaming\npm

You can refer more on https://github.com/keystonejs/generator-keystone

Hoisch answered 21/2, 2019 at 5:20 Comment(0)
C
0

We need to remove nodejs cache by performing the following steps:

  1. Uninstall Nodejs
  2. Please try to delete npm & npm-cache folders from C:\Users\myusername\AppData\Roaming
  3. Remove all environment variable related node if any
  4. Re-install node js
  5. then install yo by npm install -g yo
  6. If still not recongnized in cmd , then set path variable: C:\Users\myusername\AppData\Roaming\npm
Cliffcliffes answered 21/7, 2019 at 17:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.