realph realph - 1 year ago 190
Javascript Question

jshint Error: Cannot find module 'underscore'


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
directory is in the
directory. Is there any reason it can't find the
module? I've tried running
npm install
but I still get the same error when I run grunt.

Any ideas? Any help is appreciated.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download