javascriptnode.jsjenkinsjshintgrunt-contrib-jshint

JShint acts differently on different machines despite same code, versions and config


I have the following JShint related modules versions on my local machine and our jenkins build machine, which runs jshint before building the UI:

npm -v                                // 2.14.7
npm view jshint version               // 2.9.2
npm view grunt version                // 1.0.1
npm view grunt-contrib version        // 0.11.0
npm view grunt-contrib-jshint version // 1.0.0

Both machines use the same .jshintrc config file.

When i run jshint on locally i get no problems.
When i run it on the build machine (same code of course) - i get many errors.

I'm pretty sure it's versions related since the config and code are the same but i don't know where else to look.

Thanks!


Solution

  • As it turns out, i was using the wrong command to check my installed packages versions:

    npm view <package_name> version; // returns the latest available version of the package.
    

    The command i needed to use was:

    npm list <package_name>; // returns the installed package (and it's dependencies) version
    

    After using the right command i saw that

    local: npm list grunt-contrib-jshint; // 0.11.0 depends on JShint ~2.6.0
    jenkins: npm list grunt-contrib-jshint; // 1.0.0 depends on JShint ~2.9.1

    And was getting errors on jenkins machine since JShint ~2.9.1 is much stricter than JShint ~2.6.0.