Yeoman错误,无法访问Yeoman,问题:“错误:无法找到模块'cli-width'”

时间:2015-04-25 17:31:07

标签: node.js npm yeoman yeoman-generator

我在尝试安装yeoman发电机时遇到错误。我以前曾经与自耕农建立了许多项目。

我不知道是什么导致我得到错误,但是没有自己的命令工作了。我无法运行yo,我无法支持项目或安装任何新的生成器。

以下是我的错误的一点历史

$ yo angular

module.js:338
    throw err;
          ^
Error: Cannot find module 'through'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/node_modules/inquirer/lib/ui/bottom-bar.js:6:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

然后我安装了这个'通过'模块:

npm install -g through
npm WARN unmet dependency /usr/local/lib/node_modules/apigee-127/node_modules/apigee-remote-proxy/node_modules/inquirer requires lodash@'^3.3.1' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/apigee-127/node_modules/lodash,
npm WARN unmet dependency which is version 2.4.1
npm WARN unmet dependency /usr/local/lib/node_modules/bower/node_modules/inquirer requires chalk@'^0.5.0' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/bower/node_modules/chalk,
npm WARN unmet dependency which is version 1.0.0
npm WARN unmet dependency /usr/local/lib/node_modules/generator-gulp-webapp/node_modules/yeoman-generator/node_modules/inquirer requires lodash@'^3.3.1' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/generator-gulp-webapp/node_modules/yeoman-generator/node_modules/lodash,
npm WARN unmet dependency which is version 2.4.1
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "through"
npm ERR! node v0.12.0
npm ERR! npm  v2.7.6
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer generator-angular@0.11.1 wants generator-karma@>=0.9.0
npm ERR! peerinvalid Peer generator-angular-php@0.6.2 wants generator-karma@~0.8.3

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/me/PersonalProjects/ionicProject/npm-debug.log

好的,现在一切都好了吗?错,

 $ yo
module.js:338
    throw err;
          ^
Error: Cannot find module 'cli-width'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/node_modules/inquirer/lib/utils/tty.js:7:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

我已经停在那里,我不想在没有知道我是否在正确的道路上的情况下安装npm软件包。我找不到任何类似问题的东西,所以我不确定导致这些错误的根本原因。

我在OSX上使用Mavericks。

1 个答案:

答案 0 :(得分:0)

嗯,你没有提供你所运行的命令,所以很难提供帮助......但这肯定是npm的一个问题。

但两次常见的麻烦射击:

  1. Never run npm with sudo
  2. 阅读npm安装日志,因为它可能已经告诉您错误是什么。