简体   繁体   中英

Yeoman | yo command not found

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)

Try adding this to your user path:

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

Then, restart the console.

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.

在Windows中,在命令提示符下运行:

IF EXIST C:\Users\username\AppData\Roaming\npm SET PATH=%PATH%;C:\Users\username\AppData\Roaming\npm

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

在此输入图像描述

对我来说,我添加了这个: C:\\usr\\localPATH ,它就像一个魅力!

Please try this command:

$ sudo npm install -g yo

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

I solve it by:

  1. Update the patch which normally located at C:\\Users<myusername>\\AppData\\Roaming\\npm
  2. Open CMD as administrator.

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

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"

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.

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

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 )

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM