我已经在本地系统中安装了elasticsearch(版本6.4)。而且我必须通过作曲者安装this软件包。它安装完美,但最后,我得到以下错误
使用软件包信息加载composer存储库 从锁定文件安装依赖项(包括require-dev) 无需安装或更新 生成优化的自动加载文件 Illuminate \ Foundation \ ComposerScripts :: postAutoloadDump @php artisan包:发现
Elasticsearch \ Common \ Exceptions \ InvalidArgumentException:无法解析URI 在/var/www/html/renthisto/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php:669
665 | {
666 | $ parts = parse_url($ host);
667 |
668 | if($ parts === false){
669 |抛出新的InvalidArgumentException(“无法解析 URI“);
670 | }
671 |
672 | if(isset($ parts ['port'])!== true){
673 | $ parts ['port'] = 9200;异常跟踪:
1 Elasticsearch \ ClientBuilder :: extractURIParts(“ http://”)
/var/www/html/renthisto/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php:625
2 Elasticsearch \ ClientBuilder :: buildConnectionsFromHosts()
/var/www/html/renthisto/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php:562
请使用参数-v查看更多详细信息。 脚本@php artisan包:发现处理错误代码为1的返回的autoload-dump事件
这是我的作曲家文件
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"doctrine/dbal": "^2.8",
"elasticsearch/elasticsearch": "^6.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"jenssegers/mongodb": "^3.4",
"laravel/framework": "5.6.*",
"laravel/passport": "^7.0",
"laravel/tinker": "^1.0",
"league/flysystem-aws-s3-v3": "^1.0"
},
"require-dev": {
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.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
},
"minimum-stability": "dev",
"prefer-stable": true
}
我没有找到任何解决方案。我有以下版本 (PHP-7.2) (Laravel-5.6) (Elasticsearch-6.4)在我的本地系统中。 预先感谢。
答案 0 :(得分:2)
在service.php配置文件中,替换对我有用的主机。
之前(其中搜索主机为“ localhost:9200”)
'search' => [
'enabled' => env('SEARCH_ENABLED', false),
'hosts' => explode(',', env('SEARCH_HOST')),
]
更换主机后,它起作用了。
'search' => [
'enabled' => env('SEARCH_ENABLED', false),
'hosts' => ['127.0.0.1'],
]