找不到 'yo' 二进制文件。确保它已安装并在您的 $PATH 中。你能告诉我问题是什么吗?
Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH. Could you tell me what the problem is?
I'm using npm install -g yo gulp to install yeoman and this is the error I'm getting
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Usr\local\gulp -> C:\Usr\local\node_modules\gulp\bin\gulp.js
C:\Usr\local\yo -> C:\Usr\local\node_modules\yo\lib\cli.js
C:\Usr\local\yo-complete -> C:\Usr\local\node_modules\yo\lib\completion\index.js
> yo@3.1.0 postinstall C:\Usr\local\node_modules\yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
√ No .bowerrc file in home directory
√ Global configuration file is valid
√ NODE_PATH matches the npm root
√ No .yo-rc.json file in home directory
√ Node.js version
{ Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at notFoundError (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
cmd: 'C:\WINDOWS\system32\cmd.exe /s /c "yo "--version""' }
× yo version
{ Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at notFoundError (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
cmd: 'C:\WINDOWS\system32\cmd.exe /s /c "yo "--version""' }
√ npm version
Found potential issues on your machine :(
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\gulp\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ gulp@4.0.2
+ yo@3.1.0
updated 2 packages in 23.31s
运行下面命令查看npm把全局包放在哪里
npm config get prefix
您将得到类似于此的输出
/usr/local/Cellar/node/10.5.0_1
复制输出或路径,然后使用任何代码编辑器打开 .bashrc 或 .zshrc 文件,具体取决于您使用的终端并像这样粘贴
export PATH="$PATH:"/usr/local/Cellar/node/10.5.0_1/bin/""
然后保存后运行
source ~/.zshrc
正如 Xander Cage 所说。
- 我已经卸载了 node.js -> procedure here
- 我已经重启电脑了。
- 然后我又安装了node.js
有效。
我刚刚 运行 在 MacOS 上解决了这个问题,发现我所有的全局 npm 二进制文件都被符号链接到 /usr/local/bin
目录,yo
除外。我使用这个命令创建了一个符号链接:
ln -s /usr/local/Cellar/node/12.10.0/bin/yo /usr/local/bin/yo
(您的可能有所不同)
并且 yo
现在可以调用了。
以上对我根本不起作用。
以下解决了我的问题:
清理安装的 nodejs 并按照线程中的 dv-here 执行步骤:https://github.com/zkat/npx/issues/100
请注意,我的 npm 一直指向 C:\usr...
我想我把 npm config set prefix=
设置错了,导致我 > 收到错误。这是我修复它的方法:
在 "Administrator" 模式下打开 CMD。
npm cache clear --force
npm install
npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm
我有同样的问题,我真的不想卸载 nodejs,因为我安装了很多包。
也尝试了第二个答案,但没有成功。
然后我发现这个打勾了,那个已经关闭了:
https://github.com/yeoman/yeoman/issues/1716
用 yarn 命令安装对我有效。
yarn global add yo
然后似乎安装完成了,还安装了二进制文件。
没关系尝试使用 npm 安装它得到同样的错误,所以寻找提供更多信息
I'm using npm install -g yo gulp to install yeoman and this is the error I'm getting
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Usr\local\gulp -> C:\Usr\local\node_modules\gulp\bin\gulp.js
C:\Usr\local\yo -> C:\Usr\local\node_modules\yo\lib\cli.js
C:\Usr\local\yo-complete -> C:\Usr\local\node_modules\yo\lib\completion\index.js
> yo@3.1.0 postinstall C:\Usr\local\node_modules\yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
√ No .bowerrc file in home directory
√ Global configuration file is valid
√ NODE_PATH matches the npm root
√ No .yo-rc.json file in home directory
√ Node.js version
{ Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at notFoundError (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
cmd: 'C:\WINDOWS\system32\cmd.exe /s /c "yo "--version""' }
× yo version
{ Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at notFoundError (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
cmd: 'C:\WINDOWS\system32\cmd.exe /s /c "yo "--version""' }
√ npm version
Found potential issues on your machine :(
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\gulp\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ gulp@4.0.2
+ yo@3.1.0
updated 2 packages in 23.31s
运行下面命令查看npm把全局包放在哪里
npm config get prefix
您将得到类似于此的输出
/usr/local/Cellar/node/10.5.0_1
复制输出或路径,然后使用任何代码编辑器打开 .bashrc 或 .zshrc 文件,具体取决于您使用的终端并像这样粘贴
export PATH="$PATH:"/usr/local/Cellar/node/10.5.0_1/bin/""
然后保存后运行
source ~/.zshrc
正如 Xander Cage 所说。
- 我已经卸载了 node.js -> procedure here
- 我已经重启电脑了。
- 然后我又安装了node.js
有效。
我刚刚 运行 在 MacOS 上解决了这个问题,发现我所有的全局 npm 二进制文件都被符号链接到 /usr/local/bin
目录,yo
除外。我使用这个命令创建了一个符号链接:
ln -s /usr/local/Cellar/node/12.10.0/bin/yo /usr/local/bin/yo
(您的可能有所不同)
并且 yo
现在可以调用了。
以上对我根本不起作用。
以下解决了我的问题: 清理安装的 nodejs 并按照线程中的 dv-here 执行步骤:https://github.com/zkat/npx/issues/100 请注意,我的 npm 一直指向 C:\usr...
我想我把 npm config set prefix=
设置错了,导致我 > 收到错误。这是我修复它的方法:
在 "Administrator" 模式下打开 CMD。
npm cache clear --force
npm install
npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm
我有同样的问题,我真的不想卸载 nodejs,因为我安装了很多包。 也尝试了第二个答案,但没有成功。
然后我发现这个打勾了,那个已经关闭了:
https://github.com/yeoman/yeoman/issues/1716
用 yarn 命令安装对我有效。
yarn global add yo
然后似乎安装完成了,还安装了二进制文件。
没关系尝试使用 npm 安装它得到同样的错误,所以寻找提供更多信息