javascript 无法找到本地咕噜声

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15622869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 01:26:34  来源:igfitidea点击:

Unable to find local grunt

javascriptgruntjs

提问by Zugdud

I have grunt running this just fine locally, however after setting up my Jenkins server to do the same thing I'm running into a problem with grunt being unable to find the grunt file. Could I have missed installing/configuring something? I can't tell what's wrong from the error output, here is what i'm getting on the jenkins box:

我有 grunt 在本地运行这个就好了,但是在设置我的 Jenkins 服务器来做同样的事情后,我遇到了 grunt 无法找到 grunt 文件的问题。我可能错过了安装/配置的东西吗?我无法从错误输出中判断出什么问题,这是我在 jenkins 框中得到的信息:

[user@buildserver]# ls

[user@buildserver]# ls

AUTHORS  CHANGELOG  coverage  Gruntfile.js  package.json  README.md  reports  spec  src

[user@buildserver]# grunt

[user@buildserver]# grunt

grunt-cli: The grunt command line interface. (v0.1.6)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

Here's the Gruntfile.js

这是 Gruntfile.js

module.exports = function(grunt) {
  'use strict';

  // Project configuration.
  grunt.initConfig({
    jasmine : {
      src : 'src/**/*.js',
      options : {
        specs : 'spec/**/*.js',
        template : require('grunt-template-jasmine-istanbul'),
        templateOptions: {
          coverage: 'reports/coverage.json',
          report: 'reports/coverage'
        }
      }
    },
  });

  grunt.loadNpmTasks('grunt-contrib-jasmine');

  grunt.registerTask('default', ['jasmine']);
};                                      

回答by Vitalii Petrychuk

Have you installed grunt in your Jenkins server?

您是否在 Jenkins 服务器中安装了 grunt?

npm install grunt

回答by aqm

you can setup everything from jenkins admin interface, you don't need to install grunt locally :)

您可以从 jenkins 管理界面设置所有内容,您无需在本地安装 grunt :)

Install Jenkins Plugins

安装 Jenkins 插件

  • Git Plugin - for git
  • Git Client Plugin - for git
  • Git Parameter Plugin - for git tags
  • GitHub API Plugin - for github
  • NodeJS Plugin - integration for common javascript tools NodeJS & npm
  • Git 插件 -用于 git
  • Git 客户端插件 -用于 git
  • Git 参数插件 -用于 git 标签
  • GitHub API 插件 -用于 github
  • NodeJS 插件 -集成常见的 javascript 工具 NodeJS 和 npm

Git / Ant / Maven / NodeJS Installations

Git / Ant / Maven / NodeJS 安装

  • Goto SERVER/jenkins/configure
  • 转到服务器/詹金斯/配置
吉特
  • Git -> Git installations -> Add Git -> JGit
  • Git plugin -> Global Config user.name Value = "Anthony Mckale", Global Config user.email Value = "[email protected]"
  • Git -> Git 安装 -> 添加 Git -> JGit
  • Git 插件 -> 全局配置 user.name 值 = "Anthony Mckale",全局配置 user.email 值 = "[email protected]"
节点
  • NodeJS- > NodeJS installations -> Add NodeJS -> Name = "NodeJS 0.11.10", tick "Install automatically", select "Install from nodejs.org", add "grunt-cli" to globally installed packages
  • NodeJS-> NodeJS installations -> Add NodeJS -> Name = "NodeJS 0.11.10",勾选"Install automatically",选择"Install from nodejs.org",在全局安装的包中添加"grunt-cli"

TADA

多田

and hopefully git/nodejs and grunt will be available to you

希望您可以使用 git/nodejs 和 grunt

see the plugin wiki for more details how to add the grunt/node tasks to the jenkins job -> https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin

有关如何将 grunt/node 任务添加到 jenkins 作业的更多详细信息,请参阅插件 wiki -> https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin

it's really easy :)

这真的很容易:)

no ssh loggin required just jenkins admin rights

无需 ssh 登录,只需 jenkins 管理员权限