web-dev-qa-db-ja.com

'yo'バイナリが見つかりませんでした。それがインストールされ、$ PATHにあることを確認してください。問題は何ですか?

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
2
xander cage

Xander Cageが言ったように。

  1. Node.jsをアンインストールしました-> 手順はこちら
  2. PCを再起動しました。
  3. 次に、node.jsを再度インストールしました

うまくいきます。

0
Yannis KHACHAA

次のコマンドを実行して、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

5
Allan Guwatudde

上記は私にはまったくうまくいきませんでした。

次は私の問題を解決しました:インストールされたnodejsをクリーンアップし、スレッドのdv-hereの手順に従います: https://github.com/zkat/npx/issues/100 私のnpmがC:\ usrをポイントし続けていることに注意してください...

npm config set prefix=エラーが発生したために誤って>何かに。修正方法は次のとおりです。

「管理者」モードで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
1
Armand Jordaan

同じ問題があり、大量のパッケージがインストールされているため、nodejsをアンインストールしたくありませんでした。 2番目の回答も試してみましたが、うまくいきませんでした。

それから私はこれにチェックが入っているのを見つけました、それは閉じられています:

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

私のためにyarnコマンドを使用してインストールが機能しました。

yarn global add yo

その後、インストールもバイナリがインストールされたようです。

同じエラーが発生するnpmでインストールしようとしないでください。

0

私はMacOSでこの問題に遭遇し、私のすべてのグローバルnpmバイナリが/usr/local/binディレクトリ(yoを除く)。次のコマンドを使用してシンボリックリンクを作成しました。

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

(あなたのものは異なる場合があります)

そしてyoが呼び出し可能になりました。

0
Laizer