Composer版本1.6.3
我只是表演了:
composer require "hieu-le/active:~3.5"
我安装了一个扩展包,但事实是出乎意料的,这里是错误:
vagrant@homestead:~/Projects/cunzai$ composer require "hieu-le/active:~3.5"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing hieu-le/active (3.5.1): Downloading (100%)
Writing lock file
Generating optimized autoload files
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
(1)phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(760): Composer\Autoload\ClassLoader->addClassMap(1)
(2)phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(303): Composer\Autoload\AutoloadGenerator->getStaticFile('c4e4dd9af67a9f1...','/home/vagrant/P...', '/home/vagrant/P...', '/home/vagrant/P...', 50600)
(3)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/P...', true)
(4)phar:///usr/local/bin/composer/src/ in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 92
错误发生后,我还尝试安装另一个扩展包。事实也是错误的。所以我确定它不是扩展包。 Laravel框架和作曲家不能成为错误的原因,但我想不出一个地方。我希望在这个问题上有感恩的解决方案。
composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"hieu-le/active": "~3.5",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"mews/captcha": "~2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "~3.1",
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
答案 0 :(得分:0)
最终对我有用的是:
在composer.json
中,将streams-platform的版本更改为"anomaly/streams-platform": "1.3.219",
,并将所有这些行添加到" require"的底部。部分:
"teamtnt/laravel-scout-tntsearch-driver": "3.0.6",
"teamtnt/tntsearch": "1.3.1",
"michelf/php-markdown": "^1.8"
然后运行:
composer dump-autoload
我在Windows 10上的Virtualbox上使用Laravel Homestead Vagrant。
我使用Git Bash在Windows上的项目文件夹中直接交替运行composer update
,然后使用SSH进入Ubuntu虚拟机中的同一个项目文件夹。
我的Homestead.yaml文件使用type: "nfs"
。