gulp命令期间的EPERM

时间:2016-06-18 21:07:10

标签: node.js gulp file-permissions browser-sync

我有一个gulpfile,我与Browserify,Babelify和BrowserSync一起使用来实现我的构建工作流程。但是,我一直遇到Node.js中EPERM个错误的问题。

我的gulp clean任务中首次出现错误,该任务使用rimraf来清理我的dist目录。该任务偶尔会抛出一个错误(虽然我无法重现100%的错误)。错误是EPERM抱怨unlink ./dist/app.js行为。我尝试使用del代替rimraf,出于某种原因,它有所帮助。

但是,如果我运行gulp watch并且某些内容发生了变化,那么现在经常出现此错误:

(node:10740) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[22:52:35] Using gulpfile D:\Workspace\milestones\gulpfile.js
[22:52:35] Starting 'clean'...
[22:52:35] Finished 'clean' after 4.2 ms
[22:52:35] Starting 'build-persistent'...
[22:52:37] Finished 'build-persistent' after 1.55 s
[22:52:37] Starting 'watch'...
[22:52:37] Finished 'watch' after 92 ms
[BS] Local URL: http://localhost:3000
[BS] External URL: http://192.168.0.108:3000
[BS] Serving files from: ./
[22:52:48] Starting 'clean'...
[22:52:48] Finished 'clean' after 2.77 ms
[22:52:48] Starting 'build-persistent'...
stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^

Error: EPERM: operation not permitted, open 'D:\Workspace\milestones\dist\app.js'
at Error (native)

可以在要点here中看到完整的gulp文件。

我正在运行Windows 10。

更新:运行gulp build时似乎缺少此问题,因此可能是由BrowserSync引起的。

0 个答案:

没有答案