如何修复 laravel 作曲家更新问题( Illuminate\Foundation\ComposerScripts::postAutoloadDump 无法打开流:没有这样的文件或目录)
Posted
技术标签:
【中文标题】如何修复 laravel 作曲家更新问题( Illuminate\\Foundation\\ComposerScripts::postAutoloadDump 无法打开流:没有这样的文件或目录)【英文标题】:How to fix laravel composer update issue ( Illuminate\Foundation\ComposerScripts::postAutoloadDump failed to open stream: No such file or directory)如何修复 laravel 作曲家更新问题( Illuminate\Foundation\ComposerScripts::postAutoloadDump 无法打开流:没有这样的文件或目录) 【发布时间】:2019-09-02 13:11:12 【问题描述】:我目前正在使用一个名为 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
> 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 框架版本,但仍然没有得到任何解决方案。
【问题讨论】:
尝试 composer require guzzlehttp/guzzle 。然后运行作曲家更新。然后作曲家转储自动加载 不幸的是它不起作用,它以 : ``` 使用版本 ^6.3@dev 用于 guzzlehttp/guzzle ./composer.json 已更新 加载包含包信息的作曲家存储库 更新依赖项(包括require-dev) 无需安装或更新写入锁定文件生成优化的自动加载文件```然后给出相同的错误 php artisan config:cache 然后是 php artisan cache:clear man 我敢肯定这是非常简单的事情,我个人知道这会多么令人沮丧。坚持下去。 【参考方案1】:如果 Ankit Singh 的答案不起作用。
您已运行composer install
,但在终端窗口中出现一般错误,例如:Illuminate\Foundation\ComposerScripts::postAutoloadDump failed to ...........
。
如果您的 php 文件代码语法错误(例如错误的 use Class;
语句),则上述错误不会显示太多细节。
尝试运行php artisan migrate
,然后将通过完整路径和问题文件的行号显示问题所在。
(例如:Warning: The use statement with non-compound name 'Log' has no effect in \path\to\your\file.php on line 5
)
所以,有了这个详细的错误,我们可以转到特定文件并解决问题(在这种情况下,从 php 类包含中删除 use Class
)
希望有人在这方面寻求帮助!
【讨论】:
请分享更多细节。如果 PHP 已经在基本操作上抛出这样的错误,artisan
应该如何运行?以上是关于如何修复 laravel 作曲家更新问题( Illuminate\Foundation\ComposerScripts::postAutoloadDump 无法打开流:没有这样的文件或目录)的主要内容,如果未能解决你的问题,请参考以下文章