我的Heroku部署在构建时失败,并显示错误

时间:2020-02-10 01:47:12

标签: node.js reactjs heroku npm deployment

我正在尝试将React应用程序部署到Heroku。首先,我成功部署了我的应用程序,但此后,每次构建都失败了。我搜索了google和stackoverflow,但未能解决。如何解决我的问题?

我的git:https://github.com/tomriddle7/needyourmask和 这是我的包裹:

{
  "name": "needyourmask",
  "version": "0.1.0",
  "engines": {
    "node": "12.14.1"
  },
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.26",
    "@fortawesome/free-brands-svg-icons": "^5.12.0",
    "@fortawesome/free-regular-svg-icons": "^5.12.0",
    "@fortawesome/free-solid-svg-icons": "^5.12.0",
    "@fortawesome/react-fontawesome": "^0.1.8",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.4.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.19.2",
    "http-proxy-middleware": "^0.20.0",
    "prop-types": "^15.7.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-helmet": "^5.2.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.3.1",
    "styled-components": "^5.0.0",
    "styled-reset": "^4.1.0",
    "xml2js": "^0.4.23"
  },
  "scripts": {
    "heroku-postbuild": "cd client && yarn install && yarn build",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

和错误消息:

-----> Build
       Detected both "build" and "heroku-postbuild" scripts
       Running heroku-postbuild
       > needyourmask@0.1.0 heroku-postbuild /tmp/build_08a65f596a6bff8a2081c20af3ce98f8
       > npm run build:prod
       > needyourmask@0.1.0 build:prod /tmp/build_08a65f596a6bff8a2081c20af3ce98f8
       > ng build --prod
sh: 1: ng: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! needyourmask@0.1.0 build:prod: `ng build --prod`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the needyourmask@0.1.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.t23m8/_logs/2020-02-10T01_33_03_283Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! needyourmask@0.1.0 heroku-postbuild: `npm run build:prod`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the needyourmask@0.1.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.t23m8/_logs/2020-02-10T01_33_03_299Z-debug.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

谢谢!

0 个答案:

没有答案