当我尝试时
composer dump-autoload
我在 Linux 机器上收到以下错误
> IlluminateFoundationComposerScripts::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): ComposerUtilErrorHandler::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): IlluminateFoundationComposerScripts::postAutoloadDump(Object(ComposerScriptEvent))
#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): ComposerUtilErrorHandler::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): IlluminateFoundationComposerScripts::postAutoloadDump(Object(ComposerScriptEvent))
#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
但是当我在我的窗户机器上做它时,它工作正常。
我尝试包含的文件是
"files": [
"App/Helpers/AppHelper.php",
"App/Helpers/CoinHiveApi.php",
"App/Helpers/CloudflareAPI.php"
]
有什么我必须添加/更改的吗?
在 laravel 中,您需要提供文件/Directive 的正确路径(没有任何字母大小写更改(。
当您使用 composer.json、.env、任何提供程序等时,您需要运行以下命令,因为 laravel 会创建缓存本身。
1( 作曲家更新(如果添加新包(
2( 作曲家转储自动加载(为什么我必须运行"作曲家转储自动加载"命令才能使迁移在 laravel 中工作?
3( PHP工匠缓存:清除
4(PHP工匠视图:清除(如果您添加新视图(
正如评论中提到的,案件很重要。
作曲家采用文件路径:
"files": [
"app/Helpers/AppHelper.php",
...
]
App !== app
文件夹app
。