我有以下composer.json文件:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"intervention/image": "dev-master",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"predis/predis": "^1.1",
"quickpay/quickpay-php-client": "1.0.*",
"sendgrid/sendgrid": "~6.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\Foundation\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\Foundation\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
现在,当我运行composer install
时,出现以下错误:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postInstall
PHP Warning: Uncaught ErrorException: require(C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.p
Warning: Uncaught ErrorException: require(C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in C:xampphtdocsmyprojectvendorcomposerautoload_real.php:66
Stack trace:
#0 C:xampphtdocsmyprojectvendorcomposerautoload_real.php(66): ComposerUtilErrorHandler::handle(2, 'require(C:\xamp...', 'C:\xampp\htdocs...', 66, Array)
#1 C:xampphtdocsmyprojectvendorcomposerautoload_real.php(66): require()
#2 C:xampphtdocsmyprojectvendorcomposerautoload_real.php(56): composerRequiree07c9ae79fe3293bef21ef81a65b59a6('6124b4c8570aa39...', 'C:\xampp\htdocs...')
#3 C:xampphtdocsmyprojectvendorautoload.php(7): ComposerAutoloaderInite07c9ae79fe3293bef21ef81a65b59a6::getLoader()
#4 C:xampphtdocsmyprojectvendorlaravelframeworksrcIlluminateFoundationComposerScripts.php(17): require_once('C:\xampp\htdocs...')
#5 phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(282): Illumi in C:xampphtdocsmyprojectvendorcomposerautoload_real.php on line 66
PHP Fatal error: composerRequiree07c9ae79fe3293bef21ef81a65b59a6(): Failed opening required 'C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='C:xamppphpPEAR') in C:xampphtdocsmyprojectvendorcomposer
autoload_real.php on line 66
Fatal error: composerRequiree07c9ae79fe3293bef21ef81a65b59a6(): Failed opening required 'C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='C:xamppphpPEAR') in C:xampphtdocsmyprojectvendorcomposerautol
oad_real.php on line 66
当我运行php artisan serve
时:
PHP Warning: require(C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in C:xampphtdocsescorPHP Stack trace:
PHP 1. {main}() C:xampphtdocsmyprojectartisan:0
PHP 2. require() C:xampphtdocsmyprojectartisan:16
PHP 3. require() C:xampphtdocsmyprojectbootstrapautoload.php:17
PHP 4. ComposerAutoloaderInite07c9ae79fe3293bef21ef81a65b59a6::getLoader() C:xampphtdocsmyprojectvendorautoload.php:7
PHP 5. composerRequiree07c9ae79fe3293bef21ef81a65b59a6() C:xampphtdocsmyprojectvendorcomposerautoload_real.php:56
Warning: require(C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in C:xampphtdocsmyprojectvendorcomposerautoload_real.php on line 66
Call Stack:
0.2210 348056 1. {main}() C:xampphtdocsmyprojectartisan:0
0.2220 349040 2. require('C:xampphtdocsmyprojectbootstrapautoload.php') C:xampphtdocsmyprojectartisan:16
0.2229 350000 3. require('C:xampphtdocsmyprojectvendorautoload.php') C:xampphtdocsmyprojectbootstrapautoload.php:17
0.2240 364976 4. ComposerAutoloaderInite07c9ae79fe3293bef21ef81a65b59a6::getLoader() C:xampphtdocsmyprojectvendorautoload.php:7
0.2516 1349816 5. composerRequiree07c9ae79fe3293bef21ef81a65b59a6() C:xampphtdocsmyprojectvendorcomposerautoload_real.php:56
PHP Fatal error: require(): Failed opening required 'C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='C:xamppphpPEAR') in C:xampphtdocsmyprojectvendorcomposerautoload_real.php on line 66
PHP Stack trace:
PHP 1. {main}() C:xampphtdocsmyprojectartisan:0
PHP 2. require() C:xampphtdocsmyprojectartisan:16
PHP 3. require() C:xampphtdocsmyprojectbootstrapautoload.php:PHP 4. ComposerAutoloaderInite07c9ae79fe3293bef21ef81a65b59a6::getLoader() C:xampphtdocsmyprojectvendorautoload.php:7
PHP 5. composerRequiree07c9ae79fe3293bef21ef81a65b59a6() C:xampphtdocsmyprojectvendorcomposerautoload_real.php:56
Fatal error: require(): Failed opening required 'C:xampphtdocsmyprojectvendorcomposer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='C:xamppphpPEAR') in C:xampphtdocsmyprojectvendorcomposerautoload_real.php on line 66
Call Stack:
0.2210 348056 1. {main}() C:xampphtdocsmyprojectartisan:0
0.2220 349040 2. require('C:xampphtdocsmyprojectbootstrapautoload.php') C:xampphtdocsmyprojectartisan:16
0.2229 350000 3. require('C:xampphtdocsmyprojectvendorautoload.php') C:xampphtdocsmyprojectbootstrapautoload.php:17
0.2240 364976 4. ComposerAutoloaderInite07c9ae79fe3293bef21ef81a65b59a6::getLoader() C:xampphtdocsmyprojectvendorautoload.php:7
0.2516 1349816 5. composerRequiree07c9ae79fe3293bef21ef81a65b59a6() C:xampphtdocsmyprojectvendorcomposerautoload_real.php:56
谁能告诉我我错过了什么或做错了什么?
我尝试运行composer update --no-script
但是我仍然无法为该项目提供服务
似乎正在发生的事情是自动加载器"卡"在无效状态。以前包含的软件包很可能将 DeepCopy 作为依赖项,并且渴望通过自己的 composer.json classes
条目加载它。
这将迫使作曲家在每次调用自动加载器时尝试加载它,如果随后删除包,这将中断。
通常,可以通过执行以下操作来解决:
composer dump-autoload
这将基于当前的 composer.lock 重建自动加载器(不是 100%,但这就是它似乎正在做的事情(。
在最坏的情况下,如果由于某种原因dump-autoload
不起作用,那么删除供应商目录并重新运行composer install
应该可以工作。
我解决了这个问题。将所有 .htaccess 文件重置到服务器中。