无法安装约曼,因为"Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH"



所以我试图安装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

提前感谢。

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

在安装yo之前,我使用nodejs v14.19.0和npm v6.14.16.,然后我发现了一个与您相同的问题。我试过运行npm install -g yeoman-doctor没有成功。sudo npm install -g yo generator-code正常。--->yo v4.3.0

相关内容