找不到命令

Command not found

在全新的 Homestead 安装后,我 运行 遇到了访问 Yeoman 的问题。在 npm install -g yoyo doctor 之后的安装过程中一切似乎都很好,并且在安装过程中没有发现任何问题。但是,在我安装 yeoman 之后,yo: command not found 是我在 VM 上收到的错误消息。

vagrant@homestead:~$ npm install -g yo
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/home/vagrant/.node/bin/yo -> /home/vagrant/.node/lib/node_modules/yo/lib/cli.js
/home/vagrant/.node/bin/yo-complete -> /home/vagrant/.node/lib/node_modules/yo/lib/completion/index.js

> spawn-sync@1.0.15 postinstall /home/vagrant/.node/lib/node_modules/yo/node_modules/spawn-sync
> node postinstall


> yo@1.8.4 postinstall /home/vagrant/.node/lib/node_modules/yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

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

Everything looks all right!
/home/vagrant/.node/lib
└─┬ yo@1.8.4
  ├── async@1.5.2
  ├─┬ chalk@1.1.3
  │ ├── ansi-styles@2.2.1
  │ ├── escape-string-regexp@1.0.5
  │ ├── has-ansi@2.0.0
  │ ├── strip-ansi@3.0.1
  │ └── supports-color@2.0.0
  ├── cli-list@0.1.8
[[REMOVED FOR READABILITY]]
  └─┬ yosay@1.2.0
    ├── cli-boxes@1.0.0
    ├── pad-component@0.0.1
    ├─┬ taketalk@1.0.0
    │ ├── get-stdin@4.0.1
    │ └── minimist@1.2.0
    └── wrap-ansi@2.0.0

vagrant@homestead:~$ yo
yo: command not found

我在 ~/.bashrc 中的路径说明如下:PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/home/vagrant/.node/lib

还有什么我遗漏的可能导致这种情况的原因吗?

/home/vagrant/.node/bin 添加到您的路径中。 :)