Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find local grunt

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:

[user@buildserver]# ls

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

[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

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']);
};                                      
like image 502
RandomUser Avatar asked Mar 25 '13 19:03

RandomUser


People also ask

How do I install grunt locally to my project?

Installing grunt-cli locally js method to get started with a project ( npm install && npm test ) then install grunt-cli locally with npm install grunt-cli --save-dev. Then add a script to your package. json to run the associated grunt command: "scripts": { "test": "grunt test" } .

How do I install a specific version of grunt?

Installing a specific version If you need a specific version of Grunt or a Grunt plugin, run npm install grunt@VERSION --save-dev where VERSION is the version you need. This will install the specified version, adding it to your package. json devDependencies. Note that a tilde version range will be used in your package.

What is grunt cli npm?

npm install -g grunt-cli. This will put the grunt command in your system path, allowing it to be run from any directory. Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile .

What is grunt file JS?

Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file (known as a Gruntfile). Grunt was created by Ben Alman and is written in Node. js.


1 Answers

Have you installed grunt in your Jenkins server?

npm install grunt
like image 84
Vitalii Petrychuk Avatar answered Sep 30 '22 10:09

Vitalii Petrychuk