Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> 關於Linux >> Linux下gulp報錯Error:watch ENOSPC怎麼辦?

Linux下gulp報錯Error:watch ENOSPC怎麼辦?

日期:2017/1/25 10:14:19      編輯:關於Linux

  最近有用戶反映,在Fedora和Ubuntu的操作系統下使用gulp時遇到問題,gulp報錯Error:watch ENOSPC,這是怎麼回事?Linux下gulp報錯Error:watch ENOSPC該怎麼辦?

Linux下gulp報錯Error:watch ENOSPC怎麼辦?

  用gulp啟動,錯誤如下:

  Error: watch ENOSPC

  at exports._errnoException (util.js:746:11)

  at FSWatcher.start (fs.js:1172:11)

  at Object.fs.watch (fs.js:1198:11)

  at Gaze._watchDir (/home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:289:30)

  at /home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:358:10

  at iterate (/home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)

  at Object.forEachSeries (/home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:66:3)

  at Gaze._initWatched (/home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:354:10)

  at Gaze.add (/home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:177:8)

  at new Gaze (/home/ajaxGu/work/froad/anhui-standard/personal-h5/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:74:10)

  解決方案:

  當前問題主要是因為gulp的watch需要監聽很多文件的改動,但是fedora、ubuntu系統的文件句柄其實是有限制的,因此可以使用以下命令:

  echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

  以上就是Linux下gulp報錯Error:watch ENOSPC的解決方案,遇到同樣問題的用戶趕緊試試上面的方法吧!

Copyright © Windows教程網 All Rights Reserved