简体   繁体   English

已达到文件观察者数量的系统限制 - create-react-app production deploy on Heroku

[英]System limit for number of file watchers reached - create-react-app production deploy on Heroku

I am using create-react-app which is continuously deployed to Heroku.The last 2 deploys failed on Heroku and it threw this error我正在使用不断部署到 Heroku 的 create-react-app。最后 2 次部署在 Heroku 上失败,它抛出了这个错误

2022-02-27T23:29:12.758222+00:00 heroku[web.1]: Process running mem=647M(125.4%)
2022-02-27T23:29:12.781765+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2022-02-27T23:29:33.512810+00:00 heroku[web.1]: Process running mem=674M(130.3%)
2022-02-27T23:29:33.535558+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

2022-02-27T21:22:01.870428+00:00 app[web.1]: Error from chokidar (/app/src): Error: ENOSPC: System limit for number of file watchers reached, watch '/app/src/routes.ts'

2022-02-27T21:22:01.870532+00:00 app[web.1]: Error from chokidar (/app/src): Error: ENOSPC: System limit for number of file watchers reached, watch '/app/src/setupTests.ts'

...

And there are.还有。

I haven't changed any config since it was working correctly.我没有更改任何配置,因为它工作正常。 A few hours of research couldn't help me as there were only post about the same problem but related to npm start , which is solved by increasing max_user_watches .几个小时的研究对我没有帮助,因为只有关于相同问题但与npm start相关的帖子,这是通过增加max_user_watches解决的。

Assuming this is purely a React application it should use virtually no memory.假设这纯粹是一个 React 应用程序,它实际上应该使用 memory。

Build a production release and serve it as static files.构建生产版本并将其作为 static 文件提供。 Nothing needs to happen server-side other than serving up those files.除了提供这些文件之外,不需要在服务器端发生任何事情。 The easiest way to do that for a create-react-app application on Heroku us to use the mars/create-react-app-buildpack :对于 Heroku 上的create-react-app应用程序,最简单的方法是使用mars/create-react-app-buildpack

This buildpack deploys a React UI as a static web site.此 buildpack 将 React UI 部署为 static web 站点。 The Nginx web server provides optimum performance and security for the runtime. Nginx web 服务器为运行时提供最佳性能和安全性。

Configure your application to use this buildpack : 配置您的应用程序以使用此构建包

heroku buildpacks:set mars/create-react-app

Then redeploy .然后重新部署

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM