【发布时间】:2014-10-17 21:00:30
【问题描述】:
我正在接管一个现有项目。它包含一个 package.json 和 Gruntfile。根据here的指示我已经跑了
npm install
在全局安装 grunt-cli 之后。
但是,运行 grunt 会导致
$ 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.
使用 -v 运行会给出回溯:
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).." 已经被我插入替换了一个长的基本路径,它是项目的根目录。
经过进一步调查,compass.js 导入了 'tmp' 模块
var tmp = require('tmp');
谁/什么提供这个模块?
【问题讨论】:
-
Gruntfile 中有什么?
-
太多了,440 行代码,我怀疑问题实际上出在 compass.js 的“tmp”导入上,请参阅更新。