安裝 Laravel 遇到問題?你需要更新 composer.json 檔案

來源:互聯網
上載者:User

標籤:event   更新   htm   art   repo   direct   最新版   cep   安裝   

<pre class="markdown-doc">

~~~ url

轉載自 https://9iphp.com/web/laravel/laravel-install-fail-update-composer.html
~~~
在使用最新版 Composer 安裝 Laravel 的時候,你可能會遇到下面的問題而安裝失敗:

~~~ shell
$ php composer.phar create-project --prefer-dist laravel/laravel blog
Installing laravel/laravel (v5.2.15)
- Installing laravel/laravel (v5.2.15)
Loading from cache

Created project in blog
> php -r "copy(‘.env.example‘, ‘.env‘);"
> php artisan clear-compiled
PHP Warning: require(/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/laraveltest/blog/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required ‘/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php‘ (include_path=‘.:/usr/share/pear:/usr/share/php‘) in /home/vagrant/laraveltest/blog/bootstrap/autoload.php on line 17
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error


[RuntimeException]
Error Output: PHP Warning: require(/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/laraveltest/bl
og/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required ‘/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php‘ (include_path=‘.:/usr/share/pear:/usr/share/php‘) in /home/vagr
ant/laraveltest/blog/bootstrap/autoload.php on line 17


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

~~~

這是由於 Composer 最新動向了 pre-update-command 的工作方式,而這會使得 Laravel 安裝失敗。

@Jordi Boggiano 給出的原因如下:

這是由於缺少 composer.lock 檔案,因此最初的 install 命令被 update 操作替代,因為它會觸發 pre-update-cmd,而在這之前是觸發的 pre-install-cmd。
幸運的是,修複這個問題非常簡單,只需要把 php artisan clear-compiled 移動到 post-update-command 即可:

![圖片](https://static.9iphp.com/wp-content/uploads/2016/03/laravel-composer-change.png)

</pre>

安裝 Laravel 遇到問題?你需要更新 composer.json 檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.