前端

Fatal error: ENOSPC: System limi

2018-10-27  本文已影响1675人  草帽lufei

某前端工程在 Ubuntu18.04 系统环境中运行 npm run dev 命令时出现如下错误

...
Running "browserSync:bsFiles" (browserSync) task
[Browsersync] Access URLs:
 ----------------------------------------
       Local: http://localhost:3000
    External: http://192.168.199.172:3000
 ----------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.199.172:3001
 ----------------------------------------
[Browsersync] Serving files from: ./
[Browsersync] Watching files...
Fatal error: ENOSPC: System limit for number of file watchers reached, watch '/home/w/my/project/...'
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! Exit status 3
npm ERR! 
...

解决方案

在终端按顺序执行下面两个命令即可解决问题
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo sysctl --system

上一篇下一篇

猜你喜欢

热点阅读