Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH. Could you tell me what the problem is?
Asked Answered
S

5

8
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
Shinn answered 27/9, 2019 at 10:30 Comment(0)
T
3

Like Xander Cage said.

  1. I have uninstalled node.js -> procedure here
  2. I have restarted my PC.
  3. Then I installed again node.js

It work.

Turnstone answered 10/10, 2019 at 12:29 Comment(1)
Thank you it helped :)Hazy
C
13

Run the following command to see where npm puts global packages

npm config get prefix

You'll get output similar to this

/usr/local/Cellar/node/10.5.0_1

Copy the output or path and then using any code editor open your .bashrc or .zshrc file depending on the terminal you use and paste like so

export PATH="$PATH:"/usr/local/Cellar/node/10.5.0_1/bin/""

Then after saving run

source ~/.zshrc

Cornerstone answered 7/10, 2019 at 21:36 Comment(1)
i've resolved the above issue by deleting the node js npm files and then uninstalling and reinstalling nodejs. The problem must be due to incomplete or improper installation I guess.Shinn
T
3

Like Xander Cage said.

  1. I have uninstalled node.js -> procedure here
  2. I have restarted my PC.
  3. Then I installed again node.js

It work.

Turnstone answered 10/10, 2019 at 12:29 Comment(1)
Thank you it helped :)Hazy
F
3

The above didn't work for me at all.

The following solved my problem: clean installed nodejs and followed steps by dv-here in thread: https://github.com/zkat/npx/issues/100 Note that my npm kept pointing to C:\usr...

I think I set the npm config set prefix= to something mistakenly due to which I was >getting the error. Here's how I fixed it:

Open CMD in "Administrator" mode.

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
Fiber answered 2/12, 2019 at 16:20 Comment(1)
Worked, thanks! "Administrator" mode not required in my case.Arterio
B
2

I had same issue and I really didn't want uninstall nodejs as I have a lot of package installed. Tried also with the second answer and did not worked.

Then I found this ticked, that is been closed:

https://github.com/yeoman/yeoman/issues/1716

install with yarn command for me worked.

yarn global add yo

Seem then the installation went through with also binary installed.

Nevermind try to install it with npm getting same error, so looking for provide more infos

Breakneck answered 11/12, 2019 at 12:41 Comment(0)
E
1

I just ran into this issue on MacOS, and saw that all of my global npm binaries were symlinked into the /usr/local/bin directory, except for yo. I created a symlink using this command:

ln -s /usr/local/Cellar/node/12.10.0/bin/yo /usr/local/bin/yo

(Yours may vary)

And yo is now callable.

Extract answered 18/11, 2019 at 1:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.