找不到'yo'二进制文件。确保已安装它并在$ PATH中。你能告诉我问题出在哪里吗?

问题描述 投票:0回答:1
I'm using npm install -g yo gulp to install yeoman and this is the error I'm getting  
npm WARN deprecated [email protected]: 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

> [email protected] 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: [email protected] (node_modules\gulp\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
+ [email protected]
updated 2 packages in 23.31s
yeoman yeoman-generator
1个回答
0
投票

运行以下命令以查看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

© www.soinside.com 2019 - 2024. All rights reserved.