arichan07
@arichan07

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Heroku push際のエラー

現在自分でアプリを製作中なのですが
Herokuにてpushする際、

$ git push heroku master

を行ったら下記のエラーが出て来ました。

remote:  !     ERROR: Basic validation for 'composer.json' failed!
remote:  !     
remote:  !     It must be a valid JSON document compatible with Composer.
remote:  !     
remote:  !     You most likely created or edited the file by hand, and it now
remote:  !     contains a syntax error. Please refer to the documentation at
remote:  !     https://getcomposer.org/doc/ for information on the format.
remote:  !     
remote:  !     You can run 'composer validate' locally on your computer for
remote:  !     further diagnosis. Remember to also always keep your lock file
remote:  !     up to date with any changes according to the instructions at
remote:  !     https://getcomposer.org/doc/01-basic-usage.md
remote: 
remote:  !     Push rejected, failed to compile PHP app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 973bccca191f28c2bdfbadc223566c51657fa03a
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 973bccca191f28c2bdfbadc223566c51657fa03a
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 limitless-fortress-15224.
remote: 
To https://git.heroku.com/limitless-fortress-15224.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/limitless-fortress-15224.git'

composer.jsonの内容が違うと思って色々と調べてみても検討が付きません。。。

0

1Answer

You can run 'composer validate' locally on your computer for further diagnosis.
さらに診断するために、コンピュータ上でローカルに'composer validate'を実行できます。

こちらは試してみましたか?

0Like

Comments

  1. @arichan07

    Questioner

    試したところこのようなエラーが出てしまい余計路頭に迷ってしまいました。。。


    [Seld\JsonLint\ParsingException]
    "./composer.json" does not contain valid JSON
    Parse error on line 22:
    ...": "dev-master" "config": {
    ---------------------^
    Expected one of: 'EOF', '}', ':', ',', ']'


  2. 「有効なJSONが含まれていません」ということなので、正しいJSON形式になっていないのでしょう。

    一部しか記載されていないので何とも言えませんが、"dev-master"と"config"の間がスペースになっているのが怪しいですね。

Your answer might help someone💌