Laravel的Warning: require..../vendor/autoload.php错误的解决办法

Laravel的Warning: require..../vendor/autoload.php错误的解决办法

Laravel 作为PHP学习入门确实有点苦逼!但是为了所谓的艺术框架,我们只好忍了……

Git或者Composer拖下laravel示例程序代码后一般会报以下错误的。


Warning: require(D:\www\laravel-canvas\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in D:\www\laravel-canvas\bootstrap\autoload.php on line 17


Fatal error: require(): Failed opening required 'D:\www\laravel-canvas\bootstrap/../vendor/autoload.php' (include_path='\xampp\php\PEAR') in D:\var\laravel-canvas\bootstrap\autoload.php on line 17


显然,这是核心都没有拖下来的缘故!

解决办法:

1. cd 到该引用的根目录,删除 composer.lock 文件;

2. 重新在根目录执行“composer install”,这样就能重新生成 composer.lock 文件了。

如果出现php版本不匹配,可用“composer install --ignore-platform-reqs”(忽略版本匹配)。


静等它执行吧……

D:\var\laravel-canvas>composer install --ignore-platform-reqs
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 91 installs, 0 updates, 0 removals
  - Installing kylekatarnls/update-helper (1.2.0): Loading from cache
  - Installing doctrine/lexer (1.1.0): Downloading (100%)
  - Installing doctrine/annotations (v1.7.0): Downloading (100%)
 ....
 ....
 ....

 

(全文完)


6