【问题标题】:Can't install yeoman because "Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH"无法安装 yeoman,因为“找不到 'yo' 二进制文件。确保它已安装并在您的 $PATH 中”
【发布时间】:2020-07-09 12:08:24
【问题描述】:

所以我正在尝试安装 yeoman,但它给了我这个:

npm install -g yo generator-code
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/Users/X/.npm-global/bin/yo -> /Users/X/.npm-global/lib/node_modules/yo/lib/cli.js
/Users/X/.npm-global/bin/yo-complete -> /Users/X/.npm-global/lib/node_modules/yo/lib/completion/index.js

> yo@3.1.1 postinstall /Users/X/.npm-global/lib/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 Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn yo',
  path: 'yo',
  spawnargs: [ '--version' ],
  cmd: 'yo --version'
}
✖ yo version
Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn yo',
  path: 'yo',
  spawnargs: [ '--version' ],
  cmd: 'yo --version'
}
✔ npm version

Found potential issues on your machine :(
+ yo@3.1.1
+ generator-code@1.2.19
updated 2 packages in 23.236s
NOHpc02:~ William$ npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
NOHpc02:~ William$ sudo npm install -g yo
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
/Users/William/.npm-global/bin/yo -> /Users/William/.npm-global/lib/node_modules/yo/lib/cli.js
/Users/William/.npm-global/bin/yo-complete -> /Users/William/.npm-global/lib/node_modules/yo/lib/completion/index.js

> yo@3.1.1 postinstall /Users/William/.npm-global/lib/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 Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn yo',
  path: 'yo',
  spawnargs: [ '--version' ],
  cmd: 'yo --version'
}
✖ yo version
Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn yo',
  path: 'yo',
  spawnargs: [ '--version' ],
  cmd: 'yo --version'
}
✔ npm version

Found potential issues on your machine :(
+ yo@3.1.1
updated 1 package in 30.313s

我已经搜索和搜索,但其他人对同一问题的回答没有一个对我有用。

  • 我已经完成了npm install -g yeoman-doctor。没用。
  • 我已尝试运行sudo npm install -g yo generator-code。没用。
  • 我已尝试手动创建 yo 二进制文件,但找不到任何有关如何执行此操作的信息。

我的 java 和我的 node.js 都是最新的。我正在运行 MacOS Catalina 10.15.5

提前致谢。

【问题讨论】:

  • yarn global add yo试试这个/
  • 你试过“npm install -g yo”吗?
  • @mthkhaled 是的。我终于设法通过将目录更改为二进制文件来做到这一点。

标签: node.js npm yeoman


【解决方案1】:

我不确定版本节点和你是否兼容?

在安装之前,我使用的是 nodejs v14.19.0 和 npm v6.14.16。然后我发现了一个和你一样的问题。我试过运行 npm install -g yeoman-doctor 没有用。 sudo npm install -g yo generator-code 好的。 --->哟v4.3.0

【讨论】:

    猜你喜欢
    • 2014-01-23
    • 2015-07-20
    • 2022-11-17
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 1970-01-01
    • 1970-01-01
    • 2014-01-03
    相关资源
    最近更新 更多