安装 Yeoman - “找不到 Yo 命令" [英] Installing Yeoman - "Yo command not found"

查看:146
本文介绍了安装 Yeoman - “找不到 Yo 命令"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 node.js 并使用 npm-g_nosudo 脚本.然后当我运行 npm install -g yo 时,我看到一堆内容在我的终端窗口中滚动,没有错误,然后就完成了.然后我输入 yo,OS X 告诉我它找不到命令.

I have installed node.js and set up npm on my Yosemite install using the npm-g_nosudo script. When I then run npm install -g yo I see a bunch of content scroll through my terminal window, with no errors, and it completes. I then type yo and OS X tells me that it can't find the command.

Sullys-MacBook-Pro:~ Sully$ npm install -g yo
/Users/Sully/npm/bin/yo -> /Users/Sully/npm/lib/node_modules/yo/lib/cli.js

> yo@1.4.6 postinstall /Users/Sully/npm/lib/node_modules/yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory

Everything looks all right!
yo@1.4.6 /Users/Sully/npm/lib/node_modules/yo
├── titleize@1.0.0
├── array-uniq@1.0.2
├── figures@1.3.5
├── user-home@1.1.1
├── opn@1.0.2
├── humanize-string@1.0.1 (decamelize@1.0.0)
├── sort-on@1.2.0 (dot-prop@2.0.0)
├── async@0.9.0
├── yeoman-character@1.0.1 (supports-color@1.3.1)
├── string-length@1.0.0 (strip-ansi@2.0.1)
├── cross-spawn@0.2.9 (lru-cache@2.6.2)
├── findup@0.1.5 (commander@2.1.0, colors@0.6.2)
├── chalk@1.0.0 (escape-string-regexp@1.0.3, ansi-styles@2.0.1, supports-color@1.3.1, strip-ansi@2.0.1, has-ansi@1.0.3)
├── yosay@1.0.3 (ansi-regex@1.1.1, ansi-styles@2.0.1, strip-ansi@2.0.1, word-wrap@1.0.3, pad-component@0.0.1, taketalk@1.0.0, minimist@1.1.1)
├── root-check@1.0.0 (downgrade-root@1.1.0, sudo-block@1.2.0)
├── meow@3.1.0 (object-assign@2.0.0, camelcase-keys@1.0.0, minimist@1.1.1, indent-string@1.2.1)
├── package-json@1.1.0 (registry-url@3.0.3)
├── npm-keyword@1.1.1 (registry-url@3.0.3)
├── update-notifier@0.3.2 (is-npm@1.0.0, latest-version@1.0.0, semver-diff@2.0.0)
├── got@2.9.2 (lowercase-keys@1.0.0, timed-out@2.0.0, object-assign@2.0.0, is-stream@1.0.1, prepend-http@1.0.1, nested-error-stacks@1.0.0, statuses@1.2.1, infinity-agent@2.0.3, duplexify@3.3.0, read-all-stream@2.1.2)
├── fullname@1.1.0 (npmconf@2.1.1)
├── yeoman-environment@1.2.5 (log-symbols@1.0.2, escape-string-regexp@1.0.3, untildify@2.0.0, diff@1.4.0, text-table@0.2.0, debug@2.1.3, mem-fs@1.1.0, globby@1.2.0, grouped-queue@0.3.0)
├── configstore@0.3.2 (object-assign@2.0.0, xdg-basedir@1.0.1, osenv@0.1.0, graceful-fs@3.0.6, uuid@2.0.1, mkdirp@0.5.0, js-yaml@3.3.0)
├── insight@0.5.3 (object-assign@2.0.0, lodash.debounce@3.0.3, os-name@1.0.3, tough-cookie@0.12.1, request@2.55.0)
├── lodash@3.8.0
├── yeoman-doctor@1.3.2 (object-values@1.0.0, log-symbols@1.0.2, each-async@1.1.1, twig@0.7.2)
└── inquirer@0.8.3 (ansi-regex@1.1.1, cli-width@1.0.1, through@2.3.7, readline2@0.1.1, rx@2.5.2)
Sullys-MacBook-Pro:~ Sully$ yo
-bash: yo: command not found

我也尝试使用 source .bash_profile 并重新启动.仍然没有找到该命令.我做错了什么吗?

I also tried using source .bash_profile and rebooting. The command is still not found. Am I doing something wrong?

这是我的.bash_profile

# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
export COCOS_CONSOLE_ROOT=/Users/Sully/Development/Libraries/cocos2d-x-3.5/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH

# Add environment variable COCOS_TEMPLATES_ROOT for cocos2d-x
export COCOS_TEMPLATES_ROOT=/Users/Sully/Development/Libraries/cocos2d-x-3.5/templates
export PATH=$COCOS_TEMPLATES_ROOT:$PATH

# NPM
export BIN_ROOT=/usr/local/bin
export PATH=$BIN_ROOT:$PATH

这是我的完整 $PATH

This is my full $PATH

Sullys-MacBook-Pro:~ Sully$ echo $PATH
/usr/local/share/npm/bin:/usr/local/bin:/Users/Sully/Development/Libraries/cocos2d-x-3.5/templates:/Users/Sully/Development/Libraries/cocos2d-x-3.5/tools/cocos2d-console/bin:/Users/Sully/.dnx/runtimes/dnx-mono.1.0.0-beta4/bin:/usr/local/bin:/Users/Sully/Development/Libraries/cocos2d-x-3.5/templates:/Users/Sully/Development/Libraries/cocos2d-x-3.5/tools/cocos2d-console/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

推荐答案

这是通过将 export PATH=/Users/UserAccountName/npm/bin:$PATH 添加到我的 ~/.bash_profile 并重新启动 Terminal.app.

This was resolved by adding export PATH=/Users/UserAccountName/npm/bin:$PATH to my ~/.bash_profile and restarting Terminal.app.

这篇关于安装 Yeoman - “找不到 Yo 命令"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆