在 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)
如何在 Windows 上的 Ubuntu 上的 Bash 下使用 gulp.watch
?
最佳答案
目前,Windows 上 Ubuntu 上的 Bash 不支持 inotify 等文件系统观察程序。您可以在 the project's uservoice 上为此类功能投票.
进一步讨论github issue
编辑:看起来这个问题现已在开发中得到修复,并将于 2017 年初向公众发布。
关于windows - 为什么 gulp.watch 或 fs.watch 无法在 Windows 上 Ubuntu 上的 Bash 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38908773/