banner
NEWS LETTER

Composer删除Laravel组件失败

Scroll down

问题

Laravel 5.5
最近新学php,想用laravel做个小网站入入门,发现laravel自带的注册功能没有进行邮箱激活功能,就打算根据这篇文章用这个包laravel-user-verification实现,跟着做一半之后发现不太一样,就打算删了自己实现算了,所以打算删了这个包。
然后执行composer删除命令的时候,报了错。

过程

执行:

1
$ composer remove jrean/laravel-user-verification

报了这个错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
- Removing jrean/laravel-user-verification (v5.0.1)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover


[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Jrean\UserVerification\UserVerificationServiceProvider' not found


Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Removal failed, reverting ./composer.json to its original content.

解决

查了下stackoverflow看到个答主说把laravel项目里的config/app.php里面的providers对包的引用代码删了,就可以了,我就记起来我根据文章config/app.php添加过代码:

1
2
3
4
'providers' => [
...
Jrean\UserVerification\UserVerificationServiceProvider::class
],
1
2
3
4
'aliases' => [
...
'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class
],

所以我把这两段代码删了,再执行:

1
$ composer remove jrean/laravel-user-verification

就删除成功了。

Other Articles
Article table of contents TOP
  1. 1. 问题
  2. 2. 过程
  3. 3. 解决