node.js 约曼 | 找不到你的命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24511032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Yeoman | yo command not found
提问by user3789629
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.
我在使用“$ yo”命令时遇到问题,并且我的 cmd 一直告诉我找不到该命令。
i've installed yeoman through:
我已经通过以下方式安装了 yeoman:
$npm install -g yo
without any problems. I've also checked my $PATH under
没有任何问题。我还检查了我的 $PATH 下
$ 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:
并确认yo与其他节点模块一起安装。我可以调用其他命令,例如:
$ 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 导致失败
$ 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?
有没有人对出了什么问题有任何建议?我读到 $PATH 可能有问题?我可以以任何方式重置它吗?
(OS: Windows 8.1 | Node v0.10.29)
(操作系统:Windows 8.1 | Node v0.10.29)
回答by
Try adding this to your user path:
尝试将此添加到您的用户路径:
C:\Users\myusername\AppData\Roaming\npm
Then, restart the console.
然后,重新启动控制台。
回答by Ivan Zhang
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
- 我的用户名是正确的。
重新启动控制台并通过以下方式进行测试:
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 上修复了同样的问题,应该在系统 PATH 上更新 $PATH 以避免用户 PATH 被覆盖。
回答by srijishks
In windows run this in command prompt:
在 Windows 中,在命令提示符下运行:
IF EXIST C:\Users\username\AppData\Roaming\npm SET PATH=%PATH%;C:\Users\username\AppData\Roaming\npm
回答by SimplifyJS
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:\Users\myusername\AppData\Roaming\npm,卸载,全局重新安装 yo,并重新启动控制台,但仍然打印出来yo:command not found。我手动检查文件,发现它不会创建 Windows 命令脚本。我不确定这是否与此有关,但也许它可能有助于找到此问题的解决方案。我的操作系统:Windows 8.1
回答by gildniy
For me I added this:C:\usr\localto the PATH, and it worked like a charm!
对我来说,我添加了这个:C:\usr\local到PATH,它就像一个魅力!
回答by Hosein Djadidi
I solve it by:
我通过以下方式解决:
- Update the patch which normally located at
C:\Users<myusername>\AppData\Roaming\npm - Open CMD as administrator.
- 更新通常位于的补丁
C:\Users<myusername>\AppData\Roaming\npm - 以管理员身份打开 CMD。
回答by Bahu
Try these (Worked for me in Mac)
试试这些(在 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
回答by david clarke
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
在我的 Windows 机器上成功安装 yeoman 后,我得到了 yo: command not found。我能够通过用以下 /c/Users/daclar.CLARKE-BOOK/AppData/Roaming/npm/yo 替换“yo”来解决这个问题
i got that Path from finding Yeman files on my machine and copying the file path
我通过在我的机器上查找 Yeman 文件并复制文件路径获得了该路径
this allowed me to continue with my Yo commands form Git Bash so instead of doing...
这让我可以继续使用来自 Git Bash 的 Yo 命令,而不是...
$ yo hubot --adapter="slack"
i did..
我做了..
$ /c/Users/daclar.CLARKE-BOOK/AppData/Roaming/npm/yo hubot --adapter="slack"
回答by Santosh
You have to add the path where yo is installed. You can check that by giving the following command.
您必须添加 yo 的安装路径。您可以通过提供以下命令来检查。
npm config get prefix. you should get a location. Navigate to the location and see if yo is installed at the location.
npm config get prefix. 你应该得到一个位置。导航到该位置并查看 yo 是否安装在该位置。
for me, the location was C:\usr\local. So I added the same to environment variables and done.
对我来说,位置是C:\usr\local。所以我将相同的内容添加到环境变量中并完成。
回答by Aman Garg
In Windows, just install the Yeoman Generator globally by,
在 Windows 中,只需通过以下方式全局安装 Yeoman Generator,
One Line Install
npm install -g yo
One Line Install
npm install -g yo
and then add the following path in you system variables,
然后在系统变量中添加以下路径,
C:\Users\myusername\AppData\Roaming\npm
C:\Users\myusername\AppData\Roaming\npm
You can refer more on https://github.com/keystonejs/generator-keystone


