Laravel版本:5.4
PHP版本:7.0.15
操作系统和版本:ubuntu 16.04
[我从laravel 5.3升级到5.4]
在composer.json
我添加了"toin0u/geocoder-laravel": "^1.0",
。我还删除了config/geocoder.php
配置文件。
config / app.php的别名部分中没有Geocoder别名。
我在Geocoder\Laravel\Providers\GeocoderService::class,
添加了config/app.php
。但是当我作曲家更新或作曲家安装时仍然会收到错误。
```
无需安装或更新 包egeloen / http-adapter被放弃了,你应该避免使用它。请改用> php-http / httplug 写锁文件 生成自动加载文件
照亮\基金会\ ComposerScripts :: postUpdate
php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Toin0u\Geocoder\GeocoderServiceProvider' not found
``` 我的composer.json文件看起来像
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.6.4",
"toin0u/geocoder-laravel": "^1.0",
//"toin0u/geocoder-laravel": "@stable",
"laravel/framework": "5.4.*",
"illuminate/support": "5.4.x",
"illuminate/console": "5.4.x",
"symfony/process": "~3.2",
"barryvdh/laravel-async-queue": "0.6.x",
"laravelcollective/html": "5.4.x-dev"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"barryvdh/laravel-debugbar": "^2.1"
},
"autoload": {
"classmap": [
"database",
"app/Models",
"database/migrations",
"database/seeds",
"app/libraries"
],
"psr-4": {
"App\\": "app/"
}
},
"extra": {
"branch-alias": {
"dev-master": "0.6-dev"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate",
"php artisan ide-helper:meta",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
我使用的是Class' Toin0u \ Geocoder \ GeocoderServiceProvider'在我的config / app.php文件中,认为它可能是问题,因为它无法找到这个类,所以我从那里删除了仍然得到相同的错误消息。 请帮忙 。 提前谢谢!
编辑: 我的新app.php看起来像这样:(我评论了涉及Geocoder的行)
<?php
提供者之后的/ *代码* /
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Collective\Html\HtmlServiceProvider::class,
/*registering the Geocoder Service Provider */
//Geocoder\Laravel\Providers\GeocoderService::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
// Way\Generators\GeneratorsServiceProvider::class,
NoHasl\Providers\FormatServiceProvider::class,
NoHasl\Providers\GeoIPServiceProvider::class,
//Toin0u\Geocoder\GeocoderServiceProvider::class,
Barryvdh\Queue\AsyncServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'ClassLoader'=> Illuminate\Support\ClassLoader::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'HTML' => Collective\Html\HtmlFacade::class,
'Format' => NoHasl\Format::class,
'GeoIP' => NoHasl\GeoIP::class,
'Input' => Illuminate\Support\Facades\Input::class,
],
];
答案 0 :(得分:0)
从Geocoder\Laravel\Providers\GeocoderService::class,
配置文件的提供者列表中删除lin app.php
。然后运行composer install
或composer update
。安装软件包后,您可以在app.php
配置文件中添加提供程序。
如果您无法安装该软件包,请从composer.json中删除该行"toin0u/geocoder-laravel": "^1.0",
。然后运行composer require toin0u/geocoder-laravel
以执行全新安装。