Warning grunt-contrib-jshint: path must be a string;

I try to use the gshint grunt module to check my code, but always get the following error:

Running "jshint" task [D] Task source: C:\Coursera\03. Intro Angular JS\conFusion\node_modules\grunt-contrib-jshint\tasks\jshint.js Running "jshint:all" (jshint) task [D] Task source: C:\Coursera\03. Intro Angular JS\conFusion\node_modules\grunt-contrib-jshint\tasks\jshint.js Verifying property jshint.all exists in config...OK Files: Gruntfile.js, app/scripts/app.js Options: force=false, reporterOutput=null, jshintrc=".jshintrc", reporter={} Warning: Path must be a string. Received { toString: [Function], reporter: [Function] } Use --force to continue. 

the problem is that even when using -verbose and -debug it doesn’t show anything to work with an error, just “the path should be a string”, I checked the file using JSLint (using brackets), and it works quite well, the site is also excellent working.

what i have done so far.

  • Unistalled node.js and node modules 3 times (each time trying to change something).
  • tried to limit my grunt task to just check a very simple js file, and also does not work, this means that it is not related to the code or my gruntfile.js.
+7
jshint npm gruntjs
source share
3 answers

I fixed this problem by updating grunt-contrib-jshint from "0.10.0" to "0.12.0".

+18
source share

I was still getting an error after updating node to v6.4.0 .

What helped me: this comment on github (by Jeff Peck):

I found that the problem is that the reporterOutput parameter is set to zero. If you change this option to a link to an empty string, jshint will work as expected:

 options: { jshintrc: '<%= baseDir %>/.jshintrc', reporterOutput: "", ... 

The execution of this is allowed by grunt jshint to complete.

EDIT:

Ok, I updated node , but not grunt-contrib-jshint , according to Zeid Selimovich's answer . This works better than the previous workaround.

+11
source share

I got a question right after updating node (v6.9.2). It was resolved after updating grunt-contrib-jshint to the latest version ("1.1.0") by following these steps:

npm remove grunt-contrib-jshint --save-dev

npm install grunt-contrib-jshint --save-dev

+8
source share

All Articles