[英]Jenkins grunt task 'karma' not found
I'm actively working to find a solution, but this is an interesting issue. 我正在积极寻找解决方案,但这是一个有趣的问题。 I have Jenkins installed on two RedHat VMs.
我在两个RedHat VM上安装了Jenkins。 I am having trouble with a grunt task in the more recent VM, which I believe has a newer version of Jenkins.
我在较新的VM中遇到艰巨的任务,我认为它具有更新的Jenkins版本。
I check out everything with SVN first; 我先用SVN检查所有内容; that works fine.
效果很好。 Then I install the node and bower dependencies.
然后安装节点和Bower依赖项。 Next I run a couple of Grunt tasks and then do some stuff after the Maven build.
接下来,我运行几个Grunt任务,然后在Maven构建之后做一些事情。 The problem lies within the Grunt "test" task.
问题在于Grunt的“测试”任务。
Execute shell step 执行shell步骤
cd /home/user/.jenkins/workspace/app-grunt-maven/app
npm install
bower install
grunt --force lint
grunt test
grunt build
The error reads Task "karma" not found. Use --force to continue.
该错误显示
Task "karma" not found. Use --force to continue.
Task "karma" not found. Use --force to continue.
I have Grunt, Bower, Karma, and Git installed globally. 我在全球安装了Grunt,Bower,Karma和Git。
npm install
takes care of all the JS dependencies, including grunt-karma
and phantomjs
. npm install
负责所有JS依赖项,包括grunt-karma
和phantomjs
。
This is how the karma task is defined in my Gruntfile. 这就是在我的Gruntfile中定义业力任务的方式。 Also note that this job is working on a different VM.
另请注意,此作业正在其他VM上运行。 Do I need to install some other global dependencies?
我是否需要安装其他一些全局依赖项?
karma: {
unit: {
configFile: 'src/test/javascript/karma.conf.js',
singleRun: true
}
}
I solved the problem by deleting the node_modules
folder and running the Jenkins job again. 我通过删除
node_modules
文件夹并再次运行Jenkins作业解决了该问题。 The command I used was npm install
. 我使用的命令是
npm install
。 I may have used echo 'password' | sudo -S npm install
我可能已经用过
echo 'password' | sudo -S npm install
echo 'password' | sudo -S npm install
at some point, but I don't think that would've messed things up. echo 'password' | sudo -S npm install
在某个时候,但是我认为那不会搞砸。 Perhaps the problem was that I didn't install my global dependencies first, which could have caused npm to install some of the modules improperly. 也许问题是我没有先安装全局依赖项,这可能导致npm不正确地安装了某些模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.