我的MERN应用程序在本地和Heroku上运行良好,但在AWS ECS上运行不好。我已经在AWS ECS上部署了我的应用程序,当我输入AWS ELB(负载平衡器)域名时,在Google Chrome的控制台中出现以下React Router错误。
react-dom.production.min.js:189 Error
at y (router.ts:5:20)
at A (components.tsx:147:3)
at El (react-dom.production.min.js:167:137)
at Su (react-dom.production.min.js:290:337)
at bs (react-dom.production.min.js:280:389)
at gs (react-dom.production.min.js:280:320)
at vs (react-dom.production.min.js:280:180)
at os (react-dom.production.min.js:271:88)
at as (react-dom.production.min.js:268:429)
at k (scheduler.production.min.js:13:203)
di @ react-dom.production.min.js:189
n.callback @ react-dom.production.min.js:189
Ao @ react-dom.production.min.js:144
wu @ react-dom.production.min.js:262
bu @ react-dom.production.min.js:260
yu @ react-dom.production.min.js:259
(anonymous) @ react-dom.production.min.js:283
xs @ react-dom.production.min.js:281
as @ react-dom.production.min.js:270
k @ scheduler.production.min.js:13
O @ scheduler.production.min.js:14
router.ts:5 Uncaught Error
at y (router.ts:5:20)
at A (components.tsx:147:3)
at El (react-dom.production.min.js:167:137)
at Su (react-dom.production.min.js:290:337)
at bs (react-dom.production.min.js:280:389)
at gs (react-dom.production.min.js:280:320)
at vs (react-dom.production.min.js:280:180)
at os (react-dom.production.min.js:271:88)
at as (react-dom.production.min.js:268:429)
at k (scheduler.production.min.js:13:203)
y @ router.ts:5
A @ components.tsx:147
El @ react-dom.production.min.js:167
Su @ react-dom.production.min.js:290
bs @ react-dom.production.min.js:280
gs @ react-dom.production.min.js:280
vs @ react-dom.production.min.js:280
os @ react-dom.production.min.js:271
as @ react-dom.production.min.js:268
k @ scheduler.production.min.js:13
O @ scheduler.production.min.js:14
此外,当我输入我的实际域名(这是在Porkbun上购买),它说,没有网站已经注册在这个域名,即使我的域名是一个别名,我的AWS ELB域名,但我猜这是因为ELB域名不能重新别名回到实际域名,因为错误。
任何人都可以正确诊断我的错误吗?我需要修复什么?
1条答案
按热度按时间zyfwsgd61#
我想出了原因。由于某种原因,我的EC2容器使用的是旧代码,该代码在我的App.js中使用了一个Route组件,而该组件没有 Package 在Routes组件内部。