npm - -bash : yo: command not found

标签 npm yeoman

像很多人一样,我也遇到了 Yeoman 的问题。
错误 -bash: yo: command not found在 OSx 中。

我尝试添加 export PATH=/usr/local/share/npm/bin:$PATH根据某些人的建议,在我的 .bash_profile 上,仍然出现相同的错误。

我在尝试修复 Yeoman 错误时损失了 2 个小时的工作效率,但仍然一无所获。

有谁知道修复-bash: yo: command not found 的任何好的解决方案吗? ?

最佳答案

我发现对于最近版本的 npm,所有节点包都安装在 ~/npm/bin/ 中。目录。

因此,将这些行添加到您的 $PATH.profile文件 :

export PATH=$PATH:~/npm/bin

然后做 :
source ~/.profile
yo -v

关于npm - -bash : yo: command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29182326/

相关文章:

gruntjs - 是否可以更改默认值 : option in Yeoman depending on a previous answer?

angularjs - npm/yeoman 安装 generator-gulp-angular 而不需要 sudo

angularjs - 使用 Grunt 进行 Angular js 测试

npm - 在 .npmrc 中使用身份验证 token

angular - 在 GCP 上的自定义 Docker 镜像中创建卷导致错误

node.js - npm installexpress 不获取node_module

javascript - 使用 npm 包将 css 文件转换为 HTML 中的内联样式

javascript - 在客户端部署没有 npm 的 node.js 项目

javascript - “Caller”, 'Callee',使用 Yeoman 部署时 Angular 应用程序出现严格模式错误

node.js - 如何将文件复制为模板,向其中注入(inject)值,到不同的文件夹?