之前學習 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 協議》,轉載必須註明作者和本文連結