php artisan dumpautoload,关于 Composer dump-autoload 运行报错解决方案

之前学习 laravel入门基础,运行composer dump-autoload 报错

vagrant@homestead:~/Code/larabbs$ composer dump-autoload

Generating optimized autoload files

PHP Fatal error: Uncaught TypeError: Argument 1 passed to Composer\Autoload\ClassLoader::addClassMap() must be of the type array, integer given, called in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php on line 764 and defined in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:92

Stack trace:

#0 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(764): Composer\Autoload\ClassLoader->addClassMap(1)

#1 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(303): Composer\Autoload\AutoloadGenerator->getStaticFile('1411baee70174e9...', '/home/vagrant/C...', '/home/vagrant/C...', '/home/vagrant/C...', 50600)

#2 phar:///usr/local/bin/composer/src/Composer/Command/DumpAutoloadCommand.php(76): Composer\Autoload\AutoloadGenerator->dump(Object(Composer\Config), Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\RootPackage), Object(Composer\Installer\InstallationManager), '/home/vagrant/C...', true)

#3 phar:///usr/local/ in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 92

Fatal error: Uncaught TypeError: Argument 1 passed to Composer\Autoload\ClassLoader::addClassMap() must be of the type array, integer given, called in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php on line 764 and defined in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:92

Stack trace:

#0 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(764): Composer\Autoload\ClassLoader->addClassMap(1)

#1 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(303): Composer\Autoload\AutoloadGenerator->getStaticFile('1411baee70174e9...', '/home/vagrant/C...', '/home/vagrant/C...', '/home/vagrant/C...', 50600)

#2 phar:///usr/local/bin/composer/src/Composer/Command/DumpAutoloadCommand.php(76): Composer\Autoload\AutoloadGenerator->dump(Object(Composer\Config), Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\RootPackage), Object(Composer\Installer\InstallationManager), '/home/vagrant/C...', true)

#3 phar:///usr/local/ in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 92

vagrant@homestead:~/Code/larabbs$ exiyt

exiyt: command not found

然而学习larabbs的时候 加入了helpers.php文件再次运行composer dump-autoload 依然报上面错误,然后看到一个小伙伴评论是Sublime Text 工具引起的,关闭即可,但是测试无果,后来经测试,退出虚拟机,用git直接进入目录执行composer dump-autoload 如下:

gaoyongjian@?????? MINGW64 ~/Code/larabbs (master)

$ composer dump-autoload

Generating optimized autoload files> Illuminate\Foundation\ComposerScripts::postAutoloadDump

> @php artisan package:discover --ansi

Discovered Package: facade/ignition

Discovered Package: fideloper/proxy

Discovered Package: laravel/tinker

Discovered Package: nesbot/carbon

Discovered Package: nunomaduro/collision

Package manifest generated successfully.

Generated optimized autoload files containing 3812 classes

完美解决。

本作品采用《CC 协议》,转载必须注明作者和本文链接

墨楠小

微信扫码订阅
UP更新不错过~
关注
  • 0
    点赞
  • 0
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:游动-白 设计师:我叫白小胖 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值