“ Watchpack错误(观察程序):错误:EMFILE:打开的文件太多”-NextJS

时间:2020-08-18 21:01:04

标签: node.js typescript next.js

当我尝试next dev时,watchpack在下一个应用程序中抛出此错误时遇到问题。 屏幕以以下模式不断滚动:

Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user/Projects/project/sub-project/src/pages'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user/Projects/project/sub-project/src'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user/Projects/project/sub-project'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user/Projects/project'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user/Projects'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home/my_user'
Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/home'

我能做些什么来解决这个问题?到目前为止,我尝试使用ulimit -n 65536增加打开文件的限制,但没有成功

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题,但在“观看”之后没有地址。

error screenshot

我尝试了什么:

  1. 增加ulimit
  2. 增加 sysctl 最大文件限制
  3. 安装守望者
  4. 重启电脑并重新安装watchman

它们都不起作用。最后,我删除了目录并从 GitHub 重新克隆它,问题解决了。