getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.54k stars 1.41k forks source link

Admin Panel : Add plugin error, GPM index : error #3158

Closed Ribero closed 3 years ago

Ribero commented 3 years ago

I'm using Grav v1.7.0 - Admin v1.10.0

When trying to add a Plugin (by pressing the add button on top right) instead of having the list of available plugin I get this error:

image

Environment & details: Crikey! There was an error.html.zip

when trying to list the plugins using php ./bin/gpm index

I get this error:

GPM Releases Configuration: Stable
PLUGINS [ 347 ]
Fatal error: Uncaught TypeError: Argument 1 passed to Grav\Console\Gpm\IndexCommand::sort() must be an instance of Grav\Common\GPM\Remote\Packages, instance of Grav\Common\GPM\Remote\Plugins
 given, called in /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php on line 125 and defined in /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php:255
Stack trace:
#0 /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php(125): Grav\Console\Gpm\IndexCommand->sort(Object(Grav\Common\GPM\Remote\Plugins))
#1 /var/www/html/system/src/Grav/Console/GpmCommand.php(41): Grav\Console\Gpm\IndexCommand->serve()
#2 /var/www/html/vendor/symfony/console/Command/Command.php(255): Grav\Console\GpmCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\
ConsoleOutput))
#3 /var/www/html/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Cons
ole\Output\ConsoleOutput))
 in /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php on line 255

Log file: log.txt

rhukster commented 3 years ago

Hmm. I can't replicate that. It almost appears like you have things out of date. Did you install Grav + Admin via GPM update? if you upgraded manually or by Git, have you run bin/grav composer install --no-dev to get the latest libraries.

rhukster commented 3 years ago

Btw, have you also tried forcing a GPM update with bin/grav index -f ?

Ribero commented 3 years ago

Btw, have you also tried forcing a GPM update with bin/grav index -f ?

Yes same result

Ribero commented 3 years ago

Hmm. I can't replicate that. It almost appears like you have things out of date. Did you install Grav + Admin via GPM update? if you upgraded manually or by Git, have you run bin/grav composer install --no-dev to get the latest libraries.

I use the official docker image, then upgraded to 1.7 using the Admin Panel web GUI. I installed Learn2 Git theme and the plugin to manage pages revisions. I found the issue when I tried to install the license-manager plugin to configure the NextGen editor I just bought. I had to install it using CLI because of this issue and then found that gpm index was also failing.

Is there a way to activate more logs ?

What could be the most simple way to get back to a stable situation without loosing users accounts, pages... I can reinstall but I would prefer to identify the issue before.

mahagr commented 3 years ago

Which version of PHP you're in? As I cannot reproduce this either in 7.3.26, 7.4.14 or 8.0.1. That said I kind of get where the issue comes from, but I wonder how to reproduce it..

use php -v to see the version.

mahagr commented 3 years ago

Nevermind, I found a way to reproduce this issue. :) Fixing it now.

mahagr commented 3 years ago

@Ribero Fixed CLI first. You can see my fix from above ^.

mahagr commented 3 years ago

The admin issue seems to come from an installed Presentation plugin, try disabling it first.

mahagr commented 3 years ago

It looks like path user/plugins/presentation/node_modules/reveal.js/css/theme does not exist in your installation, can you check it out? Maybe try to re-install the plugin after disabling it.

mahagr commented 3 years ago

Note: CLI issue was fixed, admin issue isn't in Grav or Admin.

Ribero commented 3 years ago

It looks like path user/plugins/presentation/node_modules/reveal.js/css/theme does not exist in your installation, can you check it out? Maybe try to re-install the plugin after disabling it.

I uninstalled all plugins, all themes (reverting to Quark and default plugins + licence manager + NextGenEditor) but I still face the same behavior

Capture d’écran 2021-01-20 à 09 53 41

Cannot add any new plugin using Admin Pannel Gui Cannot use gpm index -f without a crash

 php bin/gpm index -f
GPM Releases Configuration: Stable
PLUGINS [ 347 ]
Fatal error: Uncaught TypeError: Argument 1 passed to Grav\Console\Gpm\IndexCommand::sort() must be an instance of Grav\Common\GPM\Remote\Packages, inst
ance of Grav\Common\GPM\Remote\Plugins given, called in /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php on line 125 and defined in /var/www/h
tml/system/src/Grav/Console/Gpm/IndexCommand.php:255
Stack trace:
#0 /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php(125): Grav\Console\Gpm\IndexCommand->sort(Object(Grav\Common\GPM\Remote\Plugins))
#1 /var/www/html/system/src/Grav/Console/GpmCommand.php(41): Grav\Console\Gpm\IndexCommand->serve()
#2 /var/www/html/vendor/symfony/console/Command/Command.php(255): Grav\Console\GpmCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Ob
ject(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\Arg
vInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
 in /var/www/html/system/src/Grav/Console/Gpm/IndexCommand.php on line 255
Ribero commented 3 years ago

Ok here is an update:

I manually deleted the folder user/plugins/presentation that was still present even if not listed as an installed plugin

Immediate effect is that the Admin Panel GUI is working again as expected !

but

gpm index -f still crashes.

mahagr commented 3 years ago

GPM command has been fixed in a commit above. You can test it if you want by copying this file into system/src/Grav/Console/Gpm/IndexCommand.php.

Ribero commented 3 years ago

Tested it works. Thanks !

OleVik commented 3 years ago

The Presentation-plugin most definitely ships with the user/plugins/presentation/node_modules/reveal.js/css/theme-folder, and it is non-empty. Unless your system prevented the normal installation of the plugin, the blueprints should have no problem rendering the fields, and should fall back to None being the only option if it fails to list the themes.