api-ecosystem-for-laravel / dingo-api

Replacement repo for dingo/api
BSD 3-Clause "New" or "Revised" License
265 stars 58 forks source link

Error on composer update after dingo/blueprint 0.4.6 update #36

Closed mtx-z closed 8 months ago

mtx-z commented 1 year ago
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 9.40.1
Package version 4.0.2 (and 4.1.0)
PHP version 8.1.7
OS Windows 8.1 and Debian AWS EC2 (EBS)

Actual Behaviour

I had an error when doing a composer update :

This seems to be caused by the recent (14/05/2023) dingo\blueprint 0.4.6 update, required by api-ecosystem-for-laravel (as "dingo/blueprint": "^0.4.5").

[previous exception] [object] (ReflectionException(code: -1): Class \"Doctrine\\Common\\Annotations\\SimpleAnnotationReader\" does not exist at C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php:889)
[stacktrace]
#0 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(889): ReflectionClass->__construct('Doctrine\\\\Common...')
#1 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(770): Illuminate\\Container\\Container->build('Doctrine\\\\Common...')
#2 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(856): Illuminate\\Container\\Container->resolve('Doctrine\\\\Common...', Array, true)
#3 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(706): Illuminate\\Foundation\\Application->resolve('Doctrine\\\\Common...', Array)
#4 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(841): Illuminate\\Container\\Container->make('Doctrine\\\\Common...', Array)
#5 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(1043): Illuminate\\Foundation\\Application->make('Doctrine\\\\Common...')
#6 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(959): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#7 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(920): Illuminate\\Container\\Container->resolveDependencies(Array)
#8 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(770): Illuminate\\Container\\Container->build('Dingo\\\\Blueprint...')
#9 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(856): Illuminate\\Container\\Container->resolve('Dingo\\\\Blueprint...', Array, true)
#10 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(706): Illuminate\\Foundation\\Application->resolve('Dingo\\\\Blueprint...', Array)
#11 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(841): Illuminate\\Container\\Container->make('Dingo\\\\Blueprint...', Array)
#12 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(1431): Illuminate\\Foundation\\Application->make('Dingo\\\\Blueprint...')
-> #13 C:\\laravel-app\\vendor\\api-ecosystem-for-laravel\\dingo-api\\src\\Provider\\DingoServiceProvider.php(182): Illuminate\\Container\\Container->offsetGet('Dingo\\\\Blueprint...')
#14 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(885): Dingo\\Api\\Provider\\DingoServiceProvider->Dingo\\Api\\Provider\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#15 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(770): Illuminate\\Container\\Container->build(Object(Closure))
#16 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(856): Illuminate\\Container\\Container->resolve('Dingo\\\\Api\\\\Conso...', Array, true)
#17 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(706): Illuminate\\Foundation\\Application->resolve('Dingo\\\\Api\\\\Conso...', Array)
#18 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(841): Illuminate\\Container\\Container->make('Dingo\\\\Api\\\\Conso...', Array)
#19 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(280): Illuminate\\Foundation\\Application->make('Dingo\\\\Api\\\\Conso...')
#20 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(294): Illuminate\\Console\\Application->resolve('Dingo\\\\Api\\\\Conso...')
#21 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\ServiceProvider.php(404): Illuminate\\Console\\Application->resolveCommands(Array)
#22 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(161): Illuminate\\Support\\ServiceProvider->Illuminate\\Support\\{closure}(Object(Illuminate\\Console\\Application))
#23 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(82): Illuminate\\Console\\Application->bootstrap()
#24 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(417): Illuminate\\Console\\Application->__construct(Object(Illuminate\\Foundation\\Application), Object(Illuminate\\Events\\Dispatcher), '9.52.7')
#25 C:\\laravel-app\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(155): Illuminate\\Foundation\\Console\\Kernel->getArtisan()
#26 C:\\laravel-app\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#27 {main}

Possible Solutions

Switch back to the previous dingo\blueprint version, adding to your composer.json: "dingo/blueprint": "0.4.5"

Should I report this to dingo\blueprint ? This issue may be related.

andrej-griniuk commented 1 year ago

Having the same issue. Laravel 10.10.1 Looks like the problem is that SimpleAnnotationReader was dropped in doctrine/annotations 2.0 (https://github.com/doctrine/annotations/issues/232), but dingo/blueprint is still using it (https://github.com/dingo/blueprint/blob/master/src/Blueprint.php#LL53C1-L53C1)

TSerra-PT commented 1 year ago

I have the same problem here. I update version 9 to 10 of Laravel. The solution "adding to your composer.json: "dingo/blueprint": "0.4.5"" doesn't work because still install the version 0.4.6... :/

mtx-z commented 1 year ago

@TSerra-PT are you sure that you don't have another package requiring dingo/blueprint? Adding the strict 0.4.5 version should work after a composer update.

TSerra-PT commented 1 year ago

@mtx-z In composer.json i have the version 0.4.5, but it install the 0.46.... :/

imagem

mtx-z commented 1 year ago

I'm double checking but are you sure you're doing a "composer update"? As composer install may install 0.4.6 from lock.

TSerra-PT commented 1 year ago

@mtx-z yes...

imagem

mtx-z commented 1 year ago

Strange. You can try delete lock file (and vendor?) then composer install again. It worked from my end.

specialtactics commented 1 year ago

I can confirm this issue, the update for blueprint latest (0.4.6) isn't enough, because not only should doctrine/annotations be updated to 2, but I think the code needs to also be updated.

I will comment out the registration of the blueprint cli command for the time being and tag as a bugfix, until it's resolved in blueprint.

If anyone is using the blueprint package, please take a look at it - personally I have not been using it.

specialtactics commented 1 year ago

Tagged as v4.1.1 - but I'll keep this open as an ongoing issue, especially if anyone encounters it they can check here.

TSerra-PT commented 1 year ago

@mtx-z delete lock file and vendor did the trick. thanks!

Dimimo commented 1 year ago

Another solution is it to lock "doctrine/annotations" in tag 1.14.3, the latest version before 2.0 was published. Because of the composer.json in "dingo/blueprint@0.4.5" requires "doctrine/annotations": "~1.2 ", while "dingo/blueprint@0.4.6" requires "doctrine/annotations": "~1.2 | ^2.0". is what created this issue.

Locking "doctrine/annotations": "v1.14.3" in the composer.json file, delete the lock file and a composer update did the trick.

specialtactics commented 1 year ago

^ With above, keep in mind that v1 of doctrine/annotations doesn't support PHP 8, hence why that dep was updated in the first place.