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

 
   
  1. $ php composer.phar create-project --prefer-dist laravel/laravel blog
  2. Installing laravel/laravel (v5.2.15)
  3. - Installing laravel/laravel (v5.2.15)
  4. Loading from cache
  5.  
  6. Created project in blog
  7. > php -r "copy('.env.example', '.env');"
  8. > php artisan clear-compiled
  9. 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
  10. 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
  11. Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
  12.  
  13.  
  14. [RuntimeException]
  15. 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
  16. og/bootstrap/autoload.php on line 17
  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
  18. ant/laraveltest/blog/bootstrap/autoload.php on line 17
  19.  
  20.  
  21. 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 即可:

安装 Laravel 遇到问题?你需要更新 composer.json 文件_第1张图片

这里是完整的 ChangeLog。

你可能感兴趣的:(Laravel)