I am new to node.js and grunt. I have searched around for "Cannot find module" problems, but the module I am having trouble with is local, so this may be site specific.
I have inherited a repository with a known-valid Gruntfile and a known-valid packages.json file, and even though I have grunt installed and have installed all the dependencies, I am still getting the following failure when I run grunt:
Error: Cannot find module './grunt/util'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
...
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Note that this does not refer to the grunt-util module. This is a local module called "util", so installing grunt-util does not fix this.
Has anyone run across anything similar?
The lead from the organization I inherited this from eventually called and said he had the same problem yesterday, and re-installing grunt fixed it. Neither of us knows why, but for me it worked.
So the solution is:
sudo npm install grunt