【问题标题】:Jenkins grunt task 'karma' not foundJenkins grunt 任务“业力”未找到
【发布时间】:2016-01-04 17:18:38
【问题描述】:

我正在积极寻找解决方案,但这是一个有趣的问题。我在两个 RedHat 虚拟机上安装了 Jenkins。我在更新的虚拟机中遇到了一项繁重的任务,我相信它有更新版本的 Jenkins。

我首先使用 SVN 检查所有内容;效果很好。然后我安装 node 和 bower 依赖项。接下来我运行了几个 Grunt 任务,然后在 Maven 构建之后做一些事情。问题在于 Grunt 的“测试”任务。

执行shell步骤

cd /home/user/.jenkins/workspace/app-grunt-maven/app
npm install
bower install
grunt --force lint
grunt test
grunt build

错误为Task "karma" not found. Use --force to continue.

我在全球范围内安装了 Grunt、Bower、Karma 和 Git。 npm install 负责所有的 JS 依赖,包括 grunt-karmaphantomjs

这就是我的 Gruntfile 中 karma 任务的定义方式。另请注意,此作业正在另一个 VM 上运行。我需要安装其他一些全局依赖项吗?

karma: {
        unit: {
            configFile: 'src/test/javascript/karma.conf.js',
            singleRun: true
        }
    }

【问题讨论】:

    标签: javascript jenkins gruntjs karma-runner


    【解决方案1】:

    我通过删除 node_modules 文件夹并再次运行 Jenkins 作业解决了这个问题。我使用的命令是npm install。我可能在某些时候使用过echo 'password' | sudo -S npm install,但我认为这不会把事情搞砸。也许问题是我没有先安装全局依赖项,这可能导致 npm 无法正确安装某些模块。

    【讨论】:

      猜你喜欢
      • 2013-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-12
      • 1970-01-01
      • 2018-08-28
      相关资源
      最近更新 更多