[英]Cannot find module 'karma' while using grunt
I am using Yeoman toolkit to bootstrap an Angular web application. 我正在使用Yeoman工具包来引导Angular Web应用程序。 I've followed all the steps mentioned here . 我已经按照这里提到的所有步骤进行了操作 。 But still, apparently, grunt
can not find the karma
module. 但显然, grunt
无法找到karma
模块。 It spits out this error: 它吐出这个错误:
Loading "grunt-karma.js" tasks...ERROR
>> Error: Cannot find module 'karma'
Warning: Task "karma" not found. Use --force to continue.
Aborted due to warnings.
I've tried installing karma
both locally and globally using npm
, but nothing seems to work. 我尝试使用npm
在本地和全局安装karma
,但似乎没有任何效果。
Make sure you have installed both karma and grunt-karma before running the grunt task: 确保在运行grunt任务之前已经安装了karma和grunt-karma:
npm install karma
npm install grunt-karma
EDIT: One liner: 编辑:一个班轮:
npm install karma grunt-karma
I had to install the following 我必须安装以下内容
npm install phantomjs
npm install jasmine-core
npm install karma
npm install grunt-karma
Goodluck, Rajesh 古德勒克,拉杰什
Edit: One liner: 编辑:一个班轮:
npm install karma grunt-karma jasmine-core phantomjs
This work for me: 这项工作对我来说:
npm install phantomjs jasmine-core jasmine karma grunt-karma
Node version: 4.2.2
节点版本: 4.2.2
I had the exact same problem and running npm install karma
fixed it temporarily too. 我有完全相同的问题,并运行npm install karma
暂时修复它。
The issue though wasn't that karma hadn't been initialized but rather that the repository that we were using had node_modules
checked in without karma's debug folder. 但问题不是业力没有初始化,而是我们使用的存储库在没有karma的调试文件夹的情况下检查了node_modules
。
This was all because the .gitignore
file was ignoring all the debug folders for checkins. 这都是因为.gitignore
文件忽略了签入的所有调试文件夹。 Make sure your .gitignore
file isn't ignoring things you want 确保您的.gitignore
文件不会忽略您想要的内容
npm install karma
npm install grunt-karma
above command will fix the issue. 上面的命令将解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.