在使用 homestead 的虚拟环境下 composer require somethings
, 发现不能生成 autoloader 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 760 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(760): Composer\Autoload\ClassLoader->addClassMap(1)
#1 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(303): Composer\Autoload\AutoloadGenerator->getStaticFile('a0f8163cb5e215a...', '/home/vagrant/c...', '/home/vagrant/c...', '/home/vagrant/c...', 50600)
#2 phar:///usr/local/bin/composer/src/Composer/Installer.php(302): 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/bin/composer/src/ in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 92
所以尝试运行 composer dumpautoload
还是同样的错误信息。
ばかなあ!!!
There maybe something wrong with my composer.json, so I checkout this file and run the damn command again.
Ya~
f**k off
So I reload virtual box and try one more time, It works.