如何解决laravel composer更新问题(Illuminate \ Foundation \ ComposerScripts :: postAutoloadDump无法打开流:无此类文件或目录)

时间:2019-04-11 20:00:19

标签: php laravel composer-php

我目前正在使用一个名为Bagisto的现有电子商务功能包来进行laravel项目。我已经从GitHub的存储库中下载了软件包文件,并在Ubuntu 18.04 OS的xampp htdocs文件夹中添加了文件。 在项目目录内的终端中启动composer update后,会出现此错误消息:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::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): Composer\Util\ErrorHandler::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): Illuminate\Foundation\C 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): Composer\Util\ErrorHandler::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): Illuminate\Foundation\C 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框架版本,但仍然没有任何解决方案。

2 个答案:

答案 0 :(得分:0)

如果 Ankit Singh 的答案不起作用。 出错后,尝试运行php artisan migrate,然后会显示出问题的完整路径和有问题的文件的行号。

答案 1 :(得分:-1)

试试这个

  1. 删除供应商文件夹
  2. 删除 composer.lock 文件
  3. composer install
  4. 就是这样,您的问题已解决