简体   繁体   English

无法在 heroku 上打开应用程序。 反应,node.js

[英]Unable to open app on heroku. React, node.js

so I've tjried several solutions I found here and unfortunately none of them seemed to work.所以我尝试了几种我在这里找到的解决方案,不幸的是它们似乎都不起作用。 I have an app which I have deployed on heroku.我有一个部署在 heroku 上的应用程序。 Frontend in react.js backend in node. react.js 中的前端,节点中的后端。 When I run当我跑

 heroku open

I receive an error 404 in console.我在控制台中收到错误 404。 Heroku logs show error code 503 and "Failed at the @ start script". Heroku 日志显示错误代码 503 和“@start 脚本失败”。 I am not sure what might be a problem, here is my json我不确定可能是什么问题,这是我的 json

 { "dependencies": { "axios": "^0.19.2", "bootstrap": "^4.5.0", "cors": "^2.8.5", "express": "4.17.1", "node-sass": "^4.14.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-redux": "^7.2.0", "react-router-dom": "^5.2.0", "react-scripts": "^3.4.1", "reactstrap": "^8.5.1", "redux": "^4.0.5", "redux-thunk": "^2.3.0", "uuidv4": "^6.1.1" }, "scripts": { "start": "node server.js", "server": "nodemon server.js", "client": "npm run start --prefix client", "dev": "concurrently \"npm run server\" \"npm run client\"", "heroku-postbuild": "NPM_PRODUCTION=false npm install --prefix client && npm run build --prefix client", }, "build": "cd client && yarn install && yarn build" }

Please advise.请指教。

Ok, so the issue is fixed now.好的,现在问题已经解决了。 The problem was version or react-scripts in packaje.json.问题是 packaje.json 中的版本或反应脚本。 It differed in client and server side.它在客户端和服务器端有所不同。 Once I made sure the version it the same I rebuild the app and it opened correctly.一旦我确定版本相同,我重建应用程序并正确打开。 Hope that helps someone in the future.希望对将来的人有所帮助。

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

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