不乱于心,不困于情。
不畏将来,不念过往。如此,安好。

laravel failed to open stream: No such file or directory in autoload.php

PS C:\Users\user\AppData\Roaming\Composer> composer

Warning: require_once(C:\Users\user\AppData\Roaming\Composer\vendor/composer/autoload_real.php): failed to open stream: No such file or directory in C:\Users\user\AppData\Roaming\Composer\vendor\autoload.php on line 5

Fatal error: require_once(): Failed opening required 'C:\Users\user\AppData\Roaming\Composer\vendor/composer/autoload_real.php' (include_path='.;C:\php\pear') in C:\Users\user\AppData\Roaming\Composer\vendor\autoload.php on line 5

php降了版本,一些拓展包不兼容,于是决定重新composer安装.试了一下不太行,就把composer目录下面的verder包删除了,结果只要运行composer就报错,重装都不行.
然后摸索出下面这个解决办法:

删除composer.lock文件;
在composer文件夹下面建一个空的autoload.php文件
运行composer dump-autoload即可重新生成初始化文件;
走正常流程,composer remove掉不兼容的包,然后执行composer install不指定包版本,composer会根据php版本安装对应的最新的包.
例如:我之前php版本是7.1.30,composer安装的var-dumper是v4.3.3的版本;
php换为7.0.25之后,composer自动安装的是v3.4.30版本,安装之前需要把php加入全局环境变量.

赞(0)
未经允许不得转载:seo优化_前端开发_渗透技术 » laravel failed to open stream: No such file or directory in autoload.php