I'm taking over an existing project. It contains a package.json and Gruntfile. According to the instructions here I've run
npm install
after installing grunt-cli globally.
However, running grunt results in
$ grunt --env=production
Loading "compass.js" tasks...ERROR
>> Error: Cannot find module 'tmp'
Warning: Task "compass" not found. Use --force to continue.
Aborted due to warnings.
Running with -v gives a traceback:
Loading "compass.js" tasks...ERROR
>> Error: Cannot find module 'tmp'
>> 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 Object.exports.init (/..(path)../node_modules/grunt-contrib-compass/tasks/lib/compass.js:4:13)
>> at Object.module.exports (/..(path)../node_modules/grunt-contrib-compass/tasks/compass.js:12:42)
>> at loadTask (/..(path)../node_modules/grunt/lib/grunt/task.js:325:10)
>> at /..(path)../node_modules/grunt/lib/grunt/task.js:361:7
>> at Array.forEach (native)
>> at loadTasks (/..(path)../node_modules/grunt/lib/grunt/task.js:360:11)
"..(path).." has been inserted by me replacing a long base path, it's the project's root.
After some further investigation, compass.js imports the 'tmp' module
var tmp = require('tmp');
Who / what provides this module?
Removing node_modules (which was under source control, to my suprise) and running
npm cache clean
npm install
solved this problem.
As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use npm cache verify
instead.
If you want to force clean, try npm cache clean --force
after that run npm cache verify
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