I've been trying to use the jshint grunt module to validate my code, but I 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 using the --verbose and -debug, it doesnt show anything to work on the error, just "path must be a string", i validated the file with JSLint (using brackets) and it works quite well, website also works fine.
what i have done so far.
I fixed this issue by updating grunt-contrib-jshint from "0.10.0" to "0.12.0".
I was still getting the error after updating node
to v6.4.0
.
What helped me was this comment on github (by Jeff Peck):
I have found the issue to be when the reporterOutput option is set to null. If you change that option to refer to an empty string, jshint will work as expected:
options: { jshintrc: '<%= baseDir %>/.jshintrc', reporterOutput: "", ...
Doing that allowed grunt jshint
to complete.
EDIT:
Well, I did have updated node
, but not grunt-contrib-jshint
, as per Zeid Selimovic's answer. That works and is better than previous workaround
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With