前提・実現したいこと
PHPで非同期通信のTodo Listアプリを作成しました。
Herokuにデプロイしたところ以下の様なエラーメッセージが表示され、デプロイが失敗してしまいます。
発生している問題・エラーメッセージ
command
1git push heroku master Enumerating objects: 57, done. 2Counting objects: 100% (57/57), done. 3Delta compression using up to 4 threads 4Compressing objects: 100% (50/50), done. 5Writing objects: 100% (57/57), 31.74 KiB | 1015.00 KiB/s, done. 6Total 57 (delta 11), reused 0 (delta 0) 7remote: Compressing source files... done. 8remote: Building source: 9remote: 10remote: -----> Building on the Heroku-20 stack 11remote: -----> Using buildpack: heroku/php 12remote: -----> PHP app detected 13remote: 14remote: ! ERROR: No 'composer.lock' found! 15remote: ! 16remote: ! A 'composer.lock' file was not found in your project, but there 17remote: ! is a 'composer.json' file with dependencies inside 'require'. 18remote: ! 19remote: ! The lock file is required in order to guarantee reliable and 20remote: ! reproducible installation of dependencies across platforms and 21remote: ! deploys. You must follow the Composer best practice of having 22remote: ! your lock file under version control in order to deploy. The 23remote: ! lock file must not be in your '.gitignore'. 24remote: ! 25remote: ! Please perform the following steps locally on your computer to 26remote: ! resolve this issue before attempting another deploy: 27remote: ! 1) remove 'composer.lock' from file '.gitignore', if present 28remote: ! 2) if no 'composer.lock' exists, run 'composer update' 29remote: ! 3) stage the lock file changes using 'git add composer.lock' 30remote: ! 4) if you edited '.gitignore', also run 'git add .gitignore' 31remote: ! 5) commit the change using 'git commit' 32remote: ! 33remote: ! Please remember to always keep your 'composer.lock' updated in 34remote: ! lockstep with 'composer.json' to avoid common problems related 35remote: ! to dependencies during collaboration and deployment. 36remote: ! 37remote: ! Please refer to the Composer documentation for further details: 38remote: ! https://getcomposer.org/doc/ 39remote: ! https://getcomposer.org/doc/01-basic-usage.md 40remote: 41remote: ! Push rejected, failed to compile PHP app. 42remote: 43remote: ! Push failed 44remote: Verifying deploy... 45remote: 46remote: ! Push rejected to dotinstall-todolist. 47remote: 48To https://git.heroku.com/dotinstall-todolist.git 49 ! [remote rejected] master -> master (pre-receive hook declined) 50error: failed to push some refs to 'https://git.heroku.com/dotinstall-todolist.git'
デプロイまでの流れ
デプロイまでまで、次の様な手順で実行しました。
heroku
1$ heroku login 2$ cd my-project/ 3$ git init 4$ heroku git:remote -a dotinstall-todolist 5$ git add . 6$ git commit -am "make it better" 7$ git push heroku master
最後のgit heroku master
の箇所でエラーが発生してします
尚、その後、heroku open
を実行すると、welcome to heroku appとだけ表示されます。
試したこと
エラー文に、composer.lock
, composer.json
が無い、とメッセージが表示されているため、conmoser update
を実行することで、rootディレクトリに取得・保存しました。
あなたの回答
tips
プレビュー