我目前正在使用名为Bagisto的现有电子商务功能包进行一个laravel项目。我已经从 GitHub 上的存储库下载了包文件,并在我的 Ubuntu 18.04 操作系统上的 xampp htdocs 文件夹中添加了文件。在项目目录内的终端中启动composer update
后出现问题,我收到以下错误消息:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
PHP Warning: Uncaught ErrorException: require(/opt/lampp/htdocs/bagisto/vendor/composer/../guzzlehttp/guzzle/src/functions_include.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php:66
Stack trace:
#0 /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php(66): ComposerUtilErrorHandler::handle(2, 'require(/opt/la...', '/opt/lampp/htdo...', 66, Array)
#1 /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php(66): require()
#2 /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php(56): composerRequire75e2944913aa928a280073a462abdd28('37a3dc5111fe8f7...', '/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/bagisto/vendor/autoload.php(7): ComposerAutoloaderInit75e2944913aa928a280073a462abdd28::getLoader()
#4 /opt/lampp/htdocs/bagisto/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(43): require_once('/opt/lampp/htdo...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(297): IlluminateFoundationC in /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php on line 66
Warning: Uncaught ErrorException: require(/opt/lampp/htdocs/bagisto/vendor/composer/../guzzlehttp/guzzle/src/functions_include.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php:66
Stack trace:
#0 /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php(66): ComposerUtilErrorHandler::handle(2, 'require(/opt/la...', '/opt/lampp/htdo...', 66, Array)
#1 /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php(66): require()
#2 /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php(56): composerRequire75e2944913aa928a280073a462abdd28('37a3dc5111fe8f7...', '/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/bagisto/vendor/autoload.php(7): ComposerAutoloaderInit75e2944913aa928a280073a462abdd28::getLoader()
#4 /opt/lampp/htdocs/bagisto/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(43): require_once('/opt/lampp/htdo...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(297): IlluminateFoundationC in /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php on line 66
PHP Fatal error: composerRequire75e2944913aa928a280073a462abdd28(): Failed opening required '/opt/lampp/htdocs/bagisto/vendor/composer/../guzzlehttp/guzzle/src/functions_include.php' (include_path='.:/usr/share/php') in /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php on line 66
Fatal error: composerRequire75e2944913aa928a280073a462abdd28(): Failed opening required '/opt/lampp/htdocs/bagisto/vendor/composer/../guzzlehttp/guzzle/src/functions_include.php' (include_path='.:/usr/share/php') in /opt/lampp/htdocs/bagisto/vendor/composer/autoload_real.php on line 66
而 composer.json 文件内容是:
{
"name": "bagisto/bagisto",
"description": "Bagisto Laravel ECommerce",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"barryvdh/laravel-dompdf": "^0.8.0@dev",
"dimsav/laravel-translatable": "^9.0",
"doctrine/dbal": "^2.9@dev",
"fideloper/proxy": "^4.0",
"flynsarmy/db-blade-compiler": "*",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"kalnoy/nestedset": "^4.3",
"konekt/concord": "^1.2",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0",
"maatwebsite/excel": "3.1.x-dev",
"nwidart/laravel-modules": "^3.2",
"prettus/l5-repository": "^2.6",
"propaganistas/laravel-intl": "^2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpro/grumphp": "dev-master",
"phpunit/phpunit": "^7.0"
},
"replace": {
"bagisto/laravel-user": "v0.1.0",
"bagisto/laravel-admin": "v0.1.0",
"bagisto/laravel-ui": "v0.1.0",
"bagisto/laravel-core": "v0.1.0",
"bagisto/laravel-attribute": "v0.1.0",
"bagisto/laravel-checkout": "v0.1.0",
"bagisto/laravel-customer": "v0.1.0",
"bagisto/laravel-inventory": "v0.1.0",
"bagisto/laravel-category": "v0.1.0",
"bagisto/laravel-product": "v0.1.0",
"bagisto/laravel-shop": "v0.1.0",
"bagisto/laravel-theme": "v0.1.0",
"bagisto/laravel-shipping": "v0.1.0",
"bagisto/laravel-payment": "v0.1.0",
"bagisto/laravel-sales": "v0.1.0",
"bagisto/laravel-tax": "v0.1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\": "app/",
"Webkul\User\": "packages/Webkul/User/src",
"Webkul\Admin\": "packages/Webkul/Admin/src",
"Webkul\Ui\": "packages/Webkul/Ui/src",
"Webkul\Category\": "packages/Webkul/Category/src",
"Webkul\Checkout\": "packages/Webkul/Checkout/src",
"Webkul\Attribute\": "packages/Webkul/Attribute/src",
"Webkul\Shop\": "packages/Webkul/Shop/src",
"Webkul\Core\": "packages/Webkul/Core/src",
"Webkul\Customer\": "packages/Webkul/Customer/src",
"Webkul\Inventory\": "packages/Webkul/Inventory/src",
"Webkul\Product\": "packages/Webkul/Product/src",
"Webkul\Theme\": "packages/Webkul/Theme/src",
"Webkul\Shipping\": "packages/Webkul/Shipping/src",
"Webkul\Payment\": "packages/Webkul/Payment/src",
"Webkul\Paypal\": "packages/Webkul/Paypal/src",
"Webkul\Sales\": "packages/Webkul/Sales/src",
"Webkul\Tax\": "packages/Webkul/Tax/src",
"Webkul\API\": "packages/Webkul/API"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{
"packagist": false
}
],
"scripts": {
"post-root-package-install": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"App\Test::test",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "stable",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev"
}
我已经尝试了一些解决此问题的方法,例如更新作曲家和 laravel 框架版本,但仍然没有得到任何解决方案。
如果安吉特·辛格的答案不起作用。
- 您运行了
composer install
,并且在终端窗口中出现一般错误,例如:IlluminateFoundationComposerScripts::postAutoloadDump failed to ...........
。 - 如果您的php文件代码语法错误(例如错误的
use Class;
语句(,那么上面的错误不会显示太多细节。 - 尝试运行
php artisan migrate
,然后将显示问题所在,完整路径和有问题的文件的行号。(例如:Warning: The use statement with non-compound name 'Log' has no effect in pathtoyourfile.php on line 5
( - 因此,有了这个详细的错误,我们可以转到特定文件并解决问题(在这种情况下,从 php 类包含中删除
use Class
(
希望有人在这方面寻求帮助!