Javascript 将react应用程序推送到Heroku加载失败

Javascript 将react应用程序推送到Heroku加载失败,javascript,node.js,reactjs,heroku,Javascript,Node.js,Reactjs,Heroku,基本上,我有这个react应用程序,我从一个开发人员那里接管了它(不幸的是,它不是很好)。应用程序结构很疯狂,但基本上是这样的: 要在本地运行应用程序,我必须运行3个命令。我从根目录开始,然后运行以下命令: cd react-web npm run postinstall npm start 当我这样做时,应用程序运行,我可以在标准端口localhost:3000上看到它 在我的根目录package.json中,我最初有以下内容: "scripts": {

基本上,我有这个react应用程序,我从一个开发人员那里接管了它(不幸的是,它不是很好)。应用程序结构很疯狂,但基本上是这样的:

要在本地运行应用程序,我必须运行3个命令。我从根目录开始,然后运行以下命令:

cd react-web
npm run postinstall
npm start
当我这样做时,应用程序运行,我可以在标准端口localhost:3000上看到它

在我的根目录
package.json
中,我最初有以下内容:

    "scripts": {
    "test-web": "cd react-web && npm test && cd ..",
    "test": "npm run test-web"
  },
    "scripts": {
    "start": "node checkEnvironmentForBuild && react-app-rewired start",
    "build": "node checkEnvironmentForBuild && react-app-rewired build",
    "deploy": "aws s3 sync build/ s3://YOUR_S3_DEPLOY_BUCKET_NAME --delete",
    "postdeploy": "aws cloudfront create-invalidation --distribution-id YOUR_CF_DISTRIBUTION_ID --paths '/*' && aws cloudfront create-invalidation --distribution-id YOUR_WWW_CF_DISTRIBUTION_ID --paths '/*'",
    "postinstall": "npm link ../shared",
    "test": "node checkEnvironmentForBuild && react-app-rewired test",
    "eject": "react-scripts eject"
  },
在我的react web
package.json
中,最初有以下内容:

    "scripts": {
    "test-web": "cd react-web && npm test && cd ..",
    "test": "npm run test-web"
  },
    "scripts": {
    "start": "node checkEnvironmentForBuild && react-app-rewired start",
    "build": "node checkEnvironmentForBuild && react-app-rewired build",
    "deploy": "aws s3 sync build/ s3://YOUR_S3_DEPLOY_BUCKET_NAME --delete",
    "postdeploy": "aws cloudfront create-invalidation --distribution-id YOUR_CF_DISTRIBUTION_ID --paths '/*' && aws cloudfront create-invalidation --distribution-id YOUR_WWW_CF_DISTRIBUTION_ID --paths '/*'",
    "postinstall": "npm link ../shared",
    "test": "node checkEnvironmentForBuild && react-app-rewired test",
    "eject": "react-scripts eject"
  },
然而,这个obv无法在Heroku上运行,因为它需要知道如何将cd刻录到react web中。 所以我把它改成:

根目录中的package.json:

"scripts": {
    "test-web": "cd react-web && npm test && cd ..",
    "test": "npm run test-web",
    "start": "cd react-web && npm run postinstall && export REACT_APP_CUSTOMER_ENVIRONMENT=x && npm start"

  },
"scripts": {
    "start": "node checkEnvironmentForBuild && react-app-rewired start",
    "build": "node checkEnvironmentForBuild && react-app-rewired build",
    "deploy": "aws s3 sync build/ s3://YOUR_S3_DEPLOY_BUCKET_NAME --delete",
    "postdeploy": "aws cloudfront create-invalidation --distribution-id YOUR_CF_DISTRIBUTION_ID --paths '/*' && aws cloudfront create-invalidation --distribution-id YOUR_WWW_CF_DISTRIBUTION_ID --paths '/*'",
    "postinstall": "npm link ../shared",
    "test": "node checkEnvironmentForBuild && react-app-rewired test",
    "eject": "react-scripts eject"
  },
和我的react web目录中的package.json:

"scripts": {
    "test-web": "cd react-web && npm test && cd ..",
    "test": "npm run test-web",
    "start": "cd react-web && npm run postinstall && export REACT_APP_CUSTOMER_ENVIRONMENT=x && npm start"

  },
"scripts": {
    "start": "node checkEnvironmentForBuild && react-app-rewired start",
    "build": "node checkEnvironmentForBuild && react-app-rewired build",
    "deploy": "aws s3 sync build/ s3://YOUR_S3_DEPLOY_BUCKET_NAME --delete",
    "postdeploy": "aws cloudfront create-invalidation --distribution-id YOUR_CF_DISTRIBUTION_ID --paths '/*' && aws cloudfront create-invalidation --distribution-id YOUR_WWW_CF_DISTRIBUTION_ID --paths '/*'",
    "postinstall": "npm link ../shared",
    "test": "node checkEnvironmentForBuild && react-app-rewired test",
    "eject": "react-scripts eject"
  },
在我的procfile中,我有
web:npm start

当我将其推送到Heroku时,它成功地推送,然后给出
h12超时错误
,并且过了一会儿它显示
2021-04-17T19:54:13.501699+00:00应用程序[web.1]:致命错误:MarkCompactCollector:年轻对象升级失败分配失败-JavaScript内存不足

然后我修改了react web package.json来包含这个

    "start": "node --max_old_space_size=2560 react-app-rewired start",
但现在它说它找不到
react应用程序重新布线

我知道这很长,可能令人困惑,但有人知道问题出在哪里吗