yodoctor:从终端安装yo时找不到命令 [英] yodoctor: command not found when installing yo from terminal

查看:214
本文介绍了yodoctor:从终端安装yo时找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我不断遇到的错误.似乎表明yodoctor存在安装后"问题.可悲的是yodoctor是yeoman团队提供的建议来帮助解决此问题.我还安装了其他node_modules(bower,grunt,打字稿).

Below is the error I keep getting. It seems to indicate a "post-install" issue with yodoctor. Sadly yodoctor is the advice given by the yeoman team to help with this issue. I have other node_modules installed (bower, grunt, typescript).

sh: yodoctor: command not found
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/bin/npm" "install" "-g" "yo"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! yo@1.5.0 postinstall: `yodoctor`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the yo@1.5.0 postinstall script 'yodoctor'.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     yodoctor
npm ERR! You can get their info via:
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jesselawson/.node_modules_global/lib/node_modules/npm-debug.log

推荐答案

此错误通常是由于某人有时使用sudo并弄乱了其npm软件包目录权限而引起的.根据经验,永远不要使用sudo.

This error is generally caused because someone used sudo at some point and messed up their npm package directory permissions. As a rule of thumb, never ever use sudo.

那么如何解决呢?以下是一些疑难解答要点:

So how can you fix it? Here's a couple troubleshooting points:

  1. 确保将npm更新为最新版本(npm install -g npm). npm 2.x具有某些竞争条件,会在安装yodoctor之前尝试运行.
  2. 确保全局npm模块文件夹为 chown/chmod您的用户.
  3. 确保 npm模块二进制文件位于您的PATH中.
  4. 如果没有任何效果,则可以通过运行npm i -g yeoman-doctor && npm i -g yo强制安装它-但这确实是最后的解决方法.
  1. Make sure you update npm to the latest version (npm install -g npm). npm 2.x had some race conditions that would try to run yodoctor before it is installed.
  2. Make sure the global npm module folders is chown/chmod to your user.
  3. Make sure npm module binaries is in your PATH.
  4. If nothing works, then you can force install it by running npm i -g yeoman-doctor && npm i -g yo - but that really is a last recourse solution.

这篇关于yodoctor:从终端安装yo时找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆