>백엔드 개발 >PHP 튜토리얼 >安装 Laravel 遇到问题?你需要更新 composer.json 文件

安装 Laravel 遇到问题?你需要更新 composer.json 文件

WBOY
WBOY원래의
2016-06-23 13:13:071600검색

在使用最新版 Composer 安装 Laravel 的时候,你可能会遇到下面的问题而安装失败:

$ php composer.phar create-project --prefer-dist laravel/laravel blogInstalling laravel/laravel (v5.2.15)  - Installing laravel/laravel (v5.2.15)    Loading from cacheCreated project in blog> php -r "copy('.env.example', '.env');"> php artisan clear-compiledPHP 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 17PHP 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 17Script 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即可:

这里是完整的 ChangeLog。

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.