无法 git 推送到 heroku 并出现解析错误

Cannot do git push to heroku with parse error

当我尝试推送到 Heroku 时遇到解析错误。 Heroku 准确地告诉我错误的原因是什么,但我找不到问题所在...... 如何修复 package.json 文件以克服此错误。 提前谢谢你。

在“git push heroku master”之后

Enumerating objects: 128, done.
Counting objects: 100% (128/128), done.
Delta compression using up to 8 threads
Compressing objects: 100% (111/111), done.
Writing objects: 100% (128/128), 162.25 KiB | 8.54 MiB/s, done.
Total 128 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. heroku/nodejs
remote:        2. heroku/ruby
remote: -----> Node.js app detected
remote: parse error: Expected separator between values at line 15, column 19
remote:  !     Unable to parse package.json
remote:
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:  !
remote:  ! ## Warning - The same version of this code has already been built: b3c6397d182444e7dcae0a097773f19a122763b1
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version b3c6397d182444e7dcae0a097773f19a122763b1
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to t-bear0513.
remote:
To https://git.heroku.com/t-bear0513.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/t-bear0513.git'

{ "姓名": "heroku_deploy_app", “私人”:是的, “依赖”:{ "@rails/actioncable": "^6.0.0", "@rails/activestorage": "^6.0.0", "@rails/ujs": "^6.0.0", "@rails/webpacker": "4.3.0", “turbolinks”:“^5.2.0” }, “版本”:“0.1.0”, “引擎”: { “节点”:“14.16.1” }, “devDependencies”:{ “webpack-dev-server”:“^4.8.1” }, }


尝试更改您正在使用的节点版本,如下所示:

  "engines": {
    "node": "14.x"
  },

还要确保它与您在本地使用的版本相匹配