1

I'm trying to deploy a simple app to Heroku, but keep getting this error message:

Alastairs-MacBook-Air:php-getting-started alastair$ git push heroku master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.23 KiB | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Installing platform packages...
remote: 
remote:  !     ERROR: Couldn't parse 'composer.lock'; it must be a valid lock
remote:        file generated by Composer. Run 'composer update', add/commit
remote:        the change, then push again.
remote: 
remote:  !     Push rejected, failed to compile PHP app
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to arcane-peak-94383.
remote: 
To https://git.heroku.com/arcane-peak-94383.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/arcane-peak-94383.git'

It's this tutorial.

I've ran composer update multiple times, add/committed the change, and reinstalled composer. All with no luck. The composer.lock file was generated by Composer, as I've regenerated it by running composer update.

Here's my composer.json file:

{
 "require" : {
"silex/silex": "^1.3",
"monolog/monolog": "^1.4",
"twig/twig": "^1.8",
"symfony/twig-bridge": "^2",
"alrik11es/cowsayphp": "^1.0"
  },
  "require-dev": {
"heroku/heroku-buildpack-php": "*"
 }
}

I know this is a simple solution, but I have been trying to resolve for a couple of hours now. Thanks in advance.

6
  • Can you show your composer.json?
    – BVengerov
    Commented Oct 7, 2016 at 9:38
  • Sure - will add into my original post. Thanks. Commented Oct 7, 2016 at 11:00
  • Seems OK.. And have you included composer.lock file in your commit?
    – BVengerov
    Commented Oct 7, 2016 at 11:05
  • Pretty sure I have. I haven't .gitignore 'd it. Seems to suggest that this is the right thing to do here Commented Oct 7, 2016 at 11:15
  • 1
    Got this: git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working directory clean Commented Oct 7, 2016 at 11:47

1 Answer 1

1

The answer from SO that should do it:

Seems that Heroku supports only latest versions of Composer.

composer self-update and further composer update (+ git add, + git commit) should fix the issue.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.