错误:使用Yeoman生成器在AngularJS中找不到模块"ansi-styles" [英] Error: Cannot find module 'ansi-styles' in AngularJS with Yeoman generator

查看:43
本文介绍了错误:使用Yeoman生成器在AngularJS中找不到模块"ansi-styles"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码以前曾在工作,但似乎已停止工作.我尝试了哟angular:route api,但返回了此错误:

My code was working previously before, but seems to have stopped working. I tried yo angular:route api but this error was returned:

Error: Cannot find module 'ansi-styles'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-angular/node_modules/chalk/index.js:2:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

我已将所有必需的依赖项添加到我的软件包文件中,更新了npm(现在在2.0.0alpha上),所有npm软件包,并运行了npm install.当我咕serve地服务时,该站点仍然可以正常工作.

I have added all the dependencies required to my package file, update npm (which is now on 2.0.0alpha), all npm packages, and ran npm install. The site still works when I grunt serve.

推荐答案

(O.P.):

我找到了出现错误的原因.我不得不更改npm根文件夹,并将软件包重新安装到默认文件夹中,现在它可以工作了.

I found the reason I got the error. I had to change the npm root folder and reinstalled my packages in the default folder and now it works.

这篇关于错误:使用Yeoman生成器在AngularJS中找不到模块"ansi-styles"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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