2

在 Windows 上的 Ubuntu 上的 Bash 上,像这样的 gulp 任务;

gulp.task('default', function() {
    gulp.watch('./', function() {console.log('change!')});
});

fs.watch或者直接从节点调用;

node -e "require('fs').watch('./')"

都失败了以下;

Error: watch ./ EPERM
    at exports._errnoException (util.js:1012:11)
    at FSWatcher.start (fs.js:1429:19)
    at Object.fs.watch (fs.js:1456:11)
    at [eval]:1:15
    at ContextifyScript.Script.runInThisContext (vm.js:25:33)
    at Object.exports.runInThisContext (vm.js:77:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:541:32)
    at bootstrap_node.js:315:29
    at _combinedTickCallback (internal/process/next_tick.js:67:7)

如何gulp.watch在 Windows 上的 Ubuntu 上使用 Bash?

4

1 回答 1

3

目前,Windows 上的 Ubuntu 上的 Bash 不支持像 inotify 这样的文件系统观察程序。您可以在项目的 uservoice上为此类功能投票。

在这个github issue中进一步讨论

编辑:看起来这已经在开发中得到修复,并将在 2017 年初的某个时候向公众发布。

于 2016-08-12T02:08:23.287 回答