简体   繁体   English

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

[英]Yeoman Errors, Can't Access Yeoman, Issue: “Error: Cannot find module 'cli-width'”

I'm getting errors trying to install yeoman generators. 尝试安装yeoman生成器时出现错误。 I have previously scaffolded out many projects with yeoman. 我以前曾与yeoman共同完成过许多项目。

I don't know what caused me to get errors, but no yeoman commands work anymore. 我不知道是什么原因导致我出错,但是yeoman命令不再起作用。 I can't run yo and I can't scaffold a project out or install any new generators. 我不能跑yo ,我不能脚手架项目出或安装任何新的发电机。

Here's a little history of my errors 这是我的错误的一些历史

$ 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)

Then I installed this 'through' module: 然后我安装了这个“直通”模块:

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

Ok so it should be all good now right? 好吧,现在应该一切都好吧? Wrong, 错误,

 $ 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)

I have stopped there, I don't want to go down a worm hole installing npm packages without knowing if I'm on the right path or not. 我已经停在那里,我不想在不知道我是否在正确路径上的情况下安装npm软件包的虫洞。 I can't find anything with similar problems so I'm not sure of the root cause that started causing these errors. 我找不到类似问题的东西,所以我不确定导致这些错误的根本原因。

I'm on OSX using Mavericks. 我在使用Mavericks的OSX上。

Well you didn't provide the command you ran, so it's hard to help... But it's definitively an issue with npm. 好吧,您没有提供运行的命令,因此很难提供帮助……但这绝对是npm的问题。

But two usual trouble shooting: 但是有两种常见的解决方法:

  1. Never run npm with sudo . 永远不要使用sudo运行npm
  2. Read the npm installation log as it may already have told you what the errors were. 阅读npm安装日志,因为它可能已经告诉您错误是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM