在`heroku-postbuild`脚本中部署到heroku失败

时间:2019-04-28 08:11:09

标签: heroku next.js

我正在尝试将应用程序部署到heroku,并且在将其推送到heroku远程时遇到此错误:

remote: npm ERR! Failed at the turisap-shop-template@1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.kFYCO/_logs/2019-04-28T07_56_57_769Z-debug.log
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to shop-react-prod.
remote:
To https://git.heroku.com/shop-react-prod.git
 ! [remote rejected] 142d22ea408d2c53211f4162f867e9e566f44609 -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shop-react-prod.git'

它说问题出在我的heroku-postbuild脚本中,该脚本在package.json中的显示如下:

"scripts": {
    "globals": "npm i -g cross-env",
    "dev": "next -p 7777",
    "build": "next build",
    "start": "next start -p $PORT",
    "test": "cross-env NODE_ENV=test jest --watch",
    "test-win": "SET NODE_ENV=test & jest --watch",
    "heroku-postbuild": "next build"
  },

我尝试在没有heroku-postbuild的情况下将该应用程序部署到heroku,并且运行良好,但是我确实需要运行next build才能使我的应用程序正常工作。

脚本next build在我的计算机上运行良好。

我该怎么做才能解决此问题?

0 个答案:

没有答案
相关问题