在云托管上部署我的 create-react-app 应用程序时出现问题
我正在尝试在 Heroku 上部署我的应用程序。我选择了 Heroku,并且使用的是免费的东西,我不知道这是否与此有关,我本来可以选择另一个。例如,我尝试将其部署在 DigitalOcean 上,但它从未结束,因此我在 1 1/2 小时后取消了它
这似乎是内存限制问题
如果我在我的计算机上执行“npm run start”或“npm run build”机器,一切正常
编辑
在搜索互联网后,我找到了解决内存限制的方法。
它正在向 Heroku 添加一个新变量: NODE_OPTIONS 变量,值: --max_old_space_size=1024
但问题没有解决
现在,构建日志是这样的:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 16.13.0
engines.npm (package.json): 8.5.4
Resolving node version 16.13.0...
Downloading and installing node 16.13.0...
Bootstrapping npm 8.5.4 (replacing 8.1.0)...
npm 8.5.4 installed
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.14.0" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! react-dom@"^16.13.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.GYeHW/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.GYeHW/_logs/2022-03-24T16_42_31_990Z-debug-0.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
正如你所看到的,问题与反应版本或其他东西有关 ?
你能告诉我如何解决这个问题吗
git hub 位于 https://github.com/rafaelsoteldosilva/serenity-sc
项目中,我使用:create-react-app、react-三纤维、styled-components
提前感谢
Rafael
I'm trying to deploy my app on Heroku. I chose Heroku and I'm using the free stuff, I don't know if it has something to do with it, I could have chosen another one. For example, I tried to deploy it on DigitalOcean, and it never ended, so I canceled it after 1 1/2 hours
It seems to be a memory limit problem
If I execute "npm run start" or "npm run build" on my machine, everything works perfectly
EDIT
After searching the internet I found a way to fix the memory limit.
It was adding a new variable to Heroku: NODE_OPTIONS variable, value: --max_old_space_size=1024
But the problem wasn't fixed
Now, the build log is this:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 16.13.0
engines.npm (package.json): 8.5.4
Resolving node version 16.13.0...
Downloading and installing node 16.13.0...
Bootstrapping npm 8.5.4 (replacing 8.1.0)...
npm 8.5.4 installed
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.14.0" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! react-dom@"^16.13.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.GYeHW/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.GYeHW/_logs/2022-03-24T16_42_31_990Z-debug-0.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
As you can see, the problem has to do with the react version or something like that
Can you tell me how to fix this problem?
The git hub is https://github.com/rafaelsoteldosilva/serenity-sc
In the project, I use: create-react-app, react-three-fiber, styled-components
Thanks in advance
Rafael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论