3

I'm trying to setup Travis CI on one JavaScript project hosted on GitHub but I'm getting error like

Loading "jshint.js" tasks...ERROR

>> Error: Cannot find module 'jshint/src/cli/cli'

Those are my files:

Gruntfile.js

module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      myFiles: ['cyrlatconverter-v0.5.4.js']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
};

.travis.yml

language: node_js
node_js:
  - 0.10

package.json

{
  "name": "node-travis",
  "version": "0.1.0",
  "devDependencies": {
    "grunt": "0.4.1",
    "grunt-cli": "0.1.9",
    "grunt-contrib-jshint": "0.6.0"
  },
  "scripts": {
    "test": "grunt --verbose"
  }
}
Dexa
  • 1,641
  • 10
  • 25
  • 2
    I found out that this problem might be because of your version, see : https://github.com/gruntjs/grunt-contrib-jshint/issues/92 - can you upgrade and try again? – Mauno Vähä Mar 28 '14 at 18:57
  • I've upped versions, and it seems to work :) But I also removed scripts part from package.json and added `grunt.registerTask('default', ['jshint']);` to the Gruntfile.js Thanks @MaunoV. – Dexa Mar 31 '14 at 10:00
  • Ok, glad to hear @Dexa :) I posted it as an answer, including your part of the findings. – Mauno Vähä Mar 31 '14 at 10:52

1 Answers1

1

Upgrading versions as discussed in github.com/gruntjs/grunt-contrib-jshint/issues/92 solved the problem.

Also as @Dexa pointed out, for him - removal of scripts part of the package.json worked and adding following to the Gruntfile.js :

grunt.registerTask('default', ['jshint']);

For clarification, ^ above registers default grunt task to run jshint when grunt is wrote to command line.

Mauno Vähä
  • 9,688
  • 3
  • 33
  • 54