請問在coding如何通過composer.json安裝自訂包,來部署PHP環境?

來源:互聯網
上載者:User
參考文檔:http://docs.coding.io/languages/php

官方通過composer.json來配置PHP環境,例如:

{    "require": {"php": "5.5.16"}}

OK,這個沒有問題,我也部署成功了。現在我要使用一個第三方開發包:https://packagist.org/packages/levi/lv,修改composer.json如下:

{    "require" : {        "php": "5.6.3",        "levi/lv" : "dev-master",        "ext-redis" : "*"    }}

就部署不成功了,錯誤提示如下:

2015-02-08T18:20:55.67+0800 [API]     OUT Updated app with guid d645cb8f-2ec6-404f-89e7-0795b8ede261 ({"state"=>"STOPPED"})2015-02-08T18:22:23.10+0800 [DEA]     OUT Got staging request for app with id d645cb8f-2ec6-404f-89e7-0795b8ede2612015-02-08T18:20:57.88+0800 [API]     OUT Updated app with guid d645cb8f-2ec6-404f-89e7-0795b8ede261 ({"state"=>"STARTED"})2015-02-08T18:22:25.12+0800 [STG]     OUT -----> Downloaded app package (8.0K)2015-02-08T18:22:25.31+0800 [STG]     OUT -------> Buildpack version 1.0.22015-02-08T18:22:25.48+0800 [STG]     OUT  !     ERROR:        Your composer.json specifies dependencies, but no composer.lock2015-02-08T18:22:25.48+0800 [STG]     OUT        was found, please check it into your repository along with composer.json!2015-02-08T18:22:25.48+0800 [STG]     OUT Staging failed: Buildpack compilation step failed2015-02-08T18:20:58.56+0800 [API]     ERR Encountered error: Staging error: failed to stage application:2015-02-08T18:20:58.56+0800 [API]     ERR Script exited with status 1

我看官方文檔有段說明是這樣的:

構建

系統會運行以下命令來解決依賴:

install --no-dev --prefer-dist --optimize-autoloader --no-interaction

好像是在部署的時候,預設就不執行安裝開發包,那麼請問如何在coding中安裝一個第三方開發包呢?

回複內容:

參考文檔:http://docs.coding.io/languages/php

官方通過composer.json來配置PHP環境,例如:

{    "require": {"php": "5.5.16"}}

OK,這個沒有問題,我也部署成功了。現在我要使用一個第三方開發包:https://packagist.org/packages/levi/lv,修改composer.json如下:

{    "require" : {        "php": "5.6.3",        "levi/lv" : "dev-master",        "ext-redis" : "*"    }}

就部署不成功了,錯誤提示如下:

2015-02-08T18:20:55.67+0800 [API]     OUT Updated app with guid d645cb8f-2ec6-404f-89e7-0795b8ede261 ({"state"=>"STOPPED"})2015-02-08T18:22:23.10+0800 [DEA]     OUT Got staging request for app with id d645cb8f-2ec6-404f-89e7-0795b8ede2612015-02-08T18:20:57.88+0800 [API]     OUT Updated app with guid d645cb8f-2ec6-404f-89e7-0795b8ede261 ({"state"=>"STARTED"})2015-02-08T18:22:25.12+0800 [STG]     OUT -----> Downloaded app package (8.0K)2015-02-08T18:22:25.31+0800 [STG]     OUT -------> Buildpack version 1.0.22015-02-08T18:22:25.48+0800 [STG]     OUT  !     ERROR:        Your composer.json specifies dependencies, but no composer.lock2015-02-08T18:22:25.48+0800 [STG]     OUT        was found, please check it into your repository along with composer.json!2015-02-08T18:22:25.48+0800 [STG]     OUT Staging failed: Buildpack compilation step failed2015-02-08T18:20:58.56+0800 [API]     ERR Encountered error: Staging error: failed to stage application:2015-02-08T18:20:58.56+0800 [API]     ERR Script exited with status 1

我看官方文檔有段說明是這樣的:

構建

系統會運行以下命令來解決依賴:

install --no-dev --prefer-dist --optimize-autoloader --no-interaction

好像是在部署的時候,預設就不執行安裝開發包,那麼請問如何在coding中安裝一個第三方開發包呢?

找到答案
http://ryankent.ca/getting-started-with-laravel-and-php-on-heroku/
http://mattstauffer.co/blog/installing-a-laravel-app-on-heroku

原話如下:

We might also run into some problems with composer because Laravel doesn't add composer.lock to git by default. If you get the following error when pushing to Heroku you need to make sure you remove composer.lock from your .gitignore so it can be pushed correctly.

!     ERROR:        Your composer.json specifies dependencies, but no composer.lock     was found, please check it into your repository along with composer.json!!     Push rejected, failed to compile PHP app

意思是確保項目中沒有composer.lock。

修改.gitignore,將composer.lock傳上來就好了

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.