问题描述
当我尝试
composer dump-autoload
我在Linux机器上收到以下错误
I get the following error on my linux machine
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
PHP Warning: Uncaught ErrorException: require(/App/Helpers/AppHelper.php): failed to open stream: No such file or directory in /var/www/page/vendor/composer/autoload_real.php:66
Stack trace:
#0 /var/www/page/vendor/composer/autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(/App/He...', '/var/www/pag...', 66, Array)
#1 /var/www/page/vendor/composer/autoload_real.php(66): require()
#2 /var/www/page/vendor/composer/autoload_real.php(56): composerRequire14063f7e5e06d46e1f9f9d444238e903('ba1c657daf90253...', '/App/Helpers/Ap...')
#3 /var/www/page/vendor/autoload.php(7): ComposerAutoloaderInit14063f7e5e06d46e1f9f9d444238e903::getLoader()
#4 /var/www/page/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(43): require_once('/var/www/pag...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(292): Illuminate\Foundation\ComposerScripts::postAutoloadDump(Object(Composer\Script\Event))
#6 phar:///usr/local/bin/com in /var/www/page/vendor/composer/autoload_real.php on line 66
Warning: Uncaught ErrorException: require(/App/Helpers/AppHelper.php): failed to open stream: No such file or directory in /var/www/page/vendor/composer/autoload_real.php:66
Stack trace:
#0 /var/www/page/vendor/composer/autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(/App/He...', '/var/www/pag...', 66, Array)
#1 /var/www/page/vendor/composer/autoload_real.php(66): require()
#2 /var/www/page/vendor/composer/autoload_real.php(56): composerRequire14063f7e5e06d46e1f9f9d444238e903('ba1c657daf90253...', '/App/Helpers/Ap...')
#3 /var/www/page/vendor/autoload.php(7): ComposerAutoloaderInit14063f7e5e06d46e1f9f9d444238e903::getLoader()
#4 /var/www/page/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(43): require_once('/var/www/pag...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(292): Illuminate\Foundation\ComposerScripts::postAutoloadDump(Object(Composer\Script\Event))
#6 phar:///usr/local/bin/com in /var/www/page/vendor/composer/autoload_real.php on line 66
PHP Fatal error: composerRequire14063f7e5e06d46e1f9f9d444238e903(): Failed opening required '/App/Helpers/AppHelper.php' (include_path='.:/usr/share/php') in /var/www/page/vendor/composer/autoload_real.php on line 66
Fatal error: composerRequire14063f7e5e06d46e1f9f9d444238e903(): Failed opening required '/App/Helpers/AppHelper.php' (include_path='.:/usr/share/php') in /var/www/page/vendor/composer/autoload_real.php on line 66
但是当我在Windows机器上执行此操作时,它工作正常.
But when I do it on my windows machine its working fine.
我要包含的文件是
"files": [
"App/Helpers/AppHelper.php",
"App/Helpers/CoinHiveApi.php",
"App/Helpers/CloudflareAPI.php"
]
有什么要添加/更改的内容吗?
Is there anyting I have to add/change?
推荐答案
在laravel中,您需要提供文件/Directive的正确路径(不区分大小写).
In laravel, You need to gives proper path(without any letter cases change) of file /Directive.
当您使用composer.json,.env,任何提供程序等时,您需要在命令下方运行,因为laravel会自行创建缓存.
When you are work with composer.json, .env, any provider etc you need to run below command because laravel create cache itself.
1)作曲家更新(如果您添加新软件包)
1) composer update (If you add new package)
2)作曲家转储自动加载()
2) composer dump-autoload (Why do I have to run "composer dump-autoload" command to make migrations work in laravel?)
3)php artisan cache:clear
3) php artisan cache:clear
4)php artisan view:clear(如果添加新视图)
4) php artisan view:clear(if you add new view)
这篇关于Composer在Linux上找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!