我想在Heroku上托管CMS,所以我做了:
git cloneherokugit push heroku master在终端中总是会出现以下错误:
remote: ----->PHP app detected
remote:
remote: ! ERROR: Your 'composer.json' lists dependencies inside 'require',
remote: but no 'composer.lock' was found. Please run 'composer update' to
remote: re-generate 'composer.lock' if necessary, and commit it into your
remote: repository. For more information, please refer to the docs at
remote: https://devcenter.heroku.com/articles/php-support#activation
remote:
remote:
remote: ! Push rejected, failed to compile PHP app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to app-name我运行了composer update,这很好,而且文件夹中还有一个composer.lock文件。
为什么这不管用?
发布于 2015-12-10 12:51:36
composer.lock文件不仅必须在本地存在,还必须提交。这样,当你推到Heroku的时候,它就会被包括在内。
试着做这样的事情:
git add composer.lockgit commit使用像Add Composer lock file这样的消息git push heroku (或任何您的遥控器被称为)原因是composer.json通常以某种模糊的方式指定依赖项,例如“最新的1.2.x发行版是什么”或“master分支上的最新提交”。您可能会想象,根据安装依赖项的时间,您和我可能会得到不同的结果。
composer.lock文件的工作是以更严格的方式锁定这些依赖项。如果您安装了一个库的最新版本1.2.x,那么它的精确版本将记录在composer.lock中,例如“Version1.2.2 at Git散列1234abc”。
通常,除非您有意更新库,否则最好使用composerinstall,而不是composer update。前者使用来自锁文件的确切版本,不更新任何内容。这样,我们就可以更有信心地使用相同的库。后者更新新版本并更改锁文件。
我从未在PHP中使用过Heroku,但它希望安装锁文件中列出的确切版本是有意义的。
https://stackoverflow.com/questions/34198713
复制相似问题