Alastair Budge
Alastair Budge

Reputation: 31

ERROR: Couldn't parse 'composer.lock'; it must be a valid lock file generated by Composer

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.

Upvotes: 1

Views: 1486

Answers (1)

BVengerov
BVengerov

Reputation: 3007

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.

Upvotes: 1

Related Questions