【问题标题】:Why does `grunt watch` fail with "ENOENT, no such file or directory" although file exists尽管文件存在,为什么`grunt watch`失败并显示“ENOENT,没有这样的文件或目录”
【发布时间】:2013-01-21 23:04:01
【问题描述】:

当我运行grunt watch 时,watch 工作一次:在我编辑并保存了一个 Javascript 文件之后,Grunt 编译/缩小所有文件。但是当我再次编辑并保存同一个文件时,Grunt 说ENOENT, no such file or directory 'client/debiki/debiki-action-edit.js'

(提到的文件是我刚刚修改的文件。)但是文件确实存在:

$ ll client/debiki/debiki-action-edit.js
-rw-rw-r-- 1 kajmagnus kajmagnus 22497 Jan 21 23:47 client/debiki/debiki-action-edit.js


如果我直接从命令行运行grunt(没有watch),Grunt 总是能够编译所有内容而不会出现任何错误。

发生了什么事?如何让grunt watch 工作?

详情:

Ubuntu Linux、Grunt v0.3.17、Node.js v0.8.4。我使用内置的watch 任务,而不是grunt-contrib-watch

完整的 Grunt 错误消息

Running "watch" task
Waiting...
/usr/local/lib/node_modules/grunt/lib/grunt/file.js:75
      throw grunt.task.taskError(e.message, e);
                       ^
TaskError: ENOENT, no such file or directory 'client/debiki/debiki-action-edit.js'
    at Task.taskError (/usr/local/lib/node_modules/grunt/lib/util/task.js:59:17)
    at /usr/local/lib/node_modules/grunt/lib/grunt/file.js:75:24
    at Array.filter (native)
    at Object.expandByType (/usr/local/lib/node_modules/grunt/lib/grunt/file.js:69:40)
    at Timer.<anonymous> (/usr/local/lib/node_modules/grunt/tasks/watch.js:158:44)
    at Timer.exports.setInterval.timer.ontimeout (timers.js:234:14)

【问题讨论】:

  • 可能值得安装最新的 0.4.0 候选版本并使用 grunt-contrib-watch(以及任何其他更新的任务)。许多修复和功能已添加到与 0.4.0 兼容的任务中,内部 0.3.x 任务已全部移出并作为 grunt-contrib-* 的一部分得到支持。
  • @jsoverson 升级到 Grunt 0.4.x 似乎已经解决了这个问题——现在grunt watch 不会死。
  • @jsoverson 如果您想将您的评论转换为答案,我会接受并关闭此问题。 (否则我会在一周后自己添加答案并接受并关闭)

标签: node.js build gruntjs


【解决方案1】:

可能值得安装最新的 0.4.0 候选版本并使用 grunt-contrib-watch(以及任何其他更新的任务)。许多修复和功能已添加到与 0.4.0 兼容的任务中,内部 0.3.x 任务已全部移出并作为 grunt-contrib-* 的一部分得到支持

为了获得批准并关闭此问题,将评论转换为答案

【讨论】:

    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多