Skip to content
Advertisement

jshint Error: Cannot find module ‘underscore’

My grunt task seems to be running perfectly fine, but every time I run it I’m getting this error:

Loading "jshint.js" tasks...ERROR
>> Error: Cannot find module 'underscore'

Is there any way to find out why this is happening? I can see the /grunt-contrib-jshint directory is in the /node_modules directory. Is there any reason it can’t find the underscore module? I’ve tried running npm install but I still get the same error when I run grunt.

Any ideas? Any help is appreciated.

Advertisement

Answer

When you have cannot find module x errors, one thing that might help sometimes is deleting the whole npm_modules folder and just running npm install again.

Sometimes, on the initial npm install, it might of failed to get one dependency for a package and it won’t try to get it again when you run npm install again, as it got all of the packages you wanted, just maybe not all the dependencies of those packages.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement