问题详情
今天在使用artisan启动laravel项目的时候,出现了如下错误:
PHP Warning: require(D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php): failed to open stream: No such file or directory in D:\Code\project\vendor\composer\autoload_real.php on line 71 Warning: require(D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php): failed to open stream: No such file or directory in D:\Code\project\vendor\composer\autoload_real.php on line 71 PHP Fatal error: require(): Failed opening required 'D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php' (include_path='.;C:\php\pear') in D:\Code\project\vendor\composer\autoload_real.php on line 71 Fatal error: require(): Failed opening required 'D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php' (include_path='.;C:\php\pear') in D:\Code\project\vendor\composer\autoload_real.php on line 71
解决思路
注:以下三种情况都有可能解决这个错误,根据自己情况进行尝试
首先判断是否是缓存造成的,运行composer clearcache命令进行缓存清除后,运行项目还是会报相同错误
D:\Code\project>composer clearcache Cache directory does not exist (cache-vcs-dir): Clearing cache (cache-repo-dir): C:\Users\fish\AppData\Local\Composer\repo Clearing cache (cache-files-dir): C:\Users\fish\AppData\Local\Composer\files Clearing cache (cache-dir): C:\Users\fish\AppData\Local\Composer All caches cleared.
然后把vendor目录删掉,使用composer install重新安装整个项目依赖,结果在安装完成后生成composer自动加载文件时还是报相同错误
Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump PHP Warning: Uncaught ErrorException: require(D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php): failed to open stream: No such file or directory in D:\Code\project\vendor\composer\autoload_real .php:71 Stack trace: #0 D:\Code\project\vendor\composer\autoload_real.php(71): Composer\Util\ErrorHandler::handle(2, 'require(D:\\Code...', 'D:\\Code\\project...', 71, Array) #1 D:\Code\project\vendor\composer\autoload_real.php(71): require() #2 D:\Code\project\vendor\composer\autoload_real.php(61): composerRequire9980c9e77675d25d9ea71e3db2d349ab('9d8e013a5160a09...', 'D:\\Code\\project...') #3 D:\Code\project\vendor\autoload.php(7): ComposerAutoloaderInit9980c9e77675d25d9ea71e3db2d349ab::getLoader() #4 D:\Code\project\vendor\laravel\framework\src\Illuminate\Foundation\ComposerScripts.php(43): require_once('D:\\Code\\project...') #5 phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(323): Illuminate\Foundation\ComposerScripts::postAutoloadDump( in D:\Code\project\vendor\composer\autoload_real.php on line 71 Warning: Uncaught ErrorException: require(D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php): failed to open stream: No such file or directory in D:\Code\project\vendor\composer\autoload_real.php: 71 Stack trace: #0 D:\Code\project\vendor\composer\autoload_real.php(71): Composer\Util\ErrorHandler::handle(2, 'require(D:\\Code...', 'D:\\Code\\project...', 71, Array) #1 D:\Code\project\vendor\composer\autoload_real.php(71): require() #2 D:\Code\project\vendor\composer\autoload_real.php(61): composerRequire9980c9e77675d25d9ea71e3db2d349ab('9d8e013a5160a09...', 'D:\\Code\\project...') #3 D:\Code\project\vendor\autoload.php(7): ComposerAutoloaderInit9980c9e77675d25d9ea71e3db2d349ab::getLoader() #4 D:\Code\project\vendor\laravel\framework\src\Illuminate\Foundation\ComposerScripts.php(43): require_once('D:\\Code\\project...') #5 phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(323): Illuminate\Foundation\ComposerScripts::postAutoloadDump( in D:\Code\project\vendor\composer\autoload_real.php on line 71 PHP Fatal error: composerRequire9980c9e77675d25d9ea71e3db2d349ab(): Failed opening required 'D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php' (include_path='.;C:\php\pear') in D:\Code\ssadmin\v endor\composer\autoload_real.php on line 71 Fatal error: composerRequire9980c9e77675d25d9ea71e3db2d349ab(): Failed opening required 'D:\Code\project\vendor\composer/../markbaker/matrix/classes/src/functions/adjoint.php' (include_path='.;C:\php\pear') in D:\Code\project\vendor \composer\autoload_real.php on line 71
最后直接运行composer update进行项目扩展更新,成功更新,并且项目运行成功!