Error extracting POT file

0

Good morning, I’m using CakePHP 4, I just tried to extract a POT file in order to translate my project using the command “bin/cake i18n extract” and I got the following error:

Exception: Cannot use 'DebugKit\Command\BenchmarkCommand' for command 'benchmark'. It is not a subclass of Cake\Console\Shell or Cake\Command\Command. In [H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Console\CommandCollection.php, line 68]

I don’t understand why the “benchmark” command must be used at this time.

During my last uses, everything went well.

I haven’t found anyone else having this problem.

Has anyone already obtained this result or have any ideas?

Thank you for your answers.

Sincerely, Alexis

Make sure your debug_kit is on the latest 4.x version compatible with your CakePHP minor version

Where can I find the Debug_kit version number?

just do a composer require --dev cakephp/debug_kit:^4.0 -W and you should be fine.

You can get the current version of the installed debug_kit via

composer info cakephp/debug_kit

or if you have a working frontend you can just open the Packages Tab of the Debug Kit and see all installed versions

Thank you

My debug_kit version is 4.4.4 for and my cakephp version si 4.2.12

Well did this resolve your problem? Because that version of the debug_kit has a valid BenchmarkCommand as you can see here: debug_kit/src/Command/BenchmarkCommand.php at 4.4.4 · cakephp/debug_kit · GitHub

Unfortunately no. I still have the same error. I just tested again.

This doesn’t make sense if you get the same exception as it states above that it isn’t a subclass of Cake\Command\Command but as can be seen by my link above it actually is.

Maybe try reinstalling all composer modules via

rm -rf vendor composer.lock
composer install --prefer-dist

Good morning,

I just tried to remove the modules and got the following error:

Remove-Item : Impossible de trouver un paramètre correspondant au nom « rf ».
Au caractère Ligne:1 : 4
+ rm -rf vendor composer.lock
+ ~~~
+ CategoryInfo : InvalidArgument : (:slight_smile: [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

By adapting the command to Powershell, I have this result:

PS H:\wamp64\www\contest\adt-ardeche> Remove-Item -Recurse -Force vendor composer.lock
Remove-Item : Impossible de trouver un paramètre positionnel acceptant l’argument « composer.lock ».
Au caractère Ligne:1 : 1

  • Remove-Item -Recurse -Force vendor composer.lock
  • CategoryInfo : InvalidArgument : (:slight_smile: [Remove-Item], ParameterBindingException
  • FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

I didn’t notice you are on windows. Thought you are on Linux or something related.

Basically you can just manually delete the vendor folder and the composer.lock file via Windows Explorer and then execute the composer command.

It’s me, I didn’t tell you that I was on Windows.

I deleted the “vendor” folder and the “composer.lock” file. Then I tried extracting the POT file again.

I have a new error message:

PS H:\wamp64\www\contest\adt-ardeche> bin/cake i18n extract

*Fatal error: Declaration of Bake\Shell\BakeShell::startup() must be compatible with Cake\Console\Shell::startup(): void in H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\bake\src\Shell\BakeShell.php on line 50*

*Call Stack:*
*0.0002 402704 1. {main}() H:\wamp64\www\contest\adt-ardeche\bin\cake.php:0*
*0.0292 2720544 2. Cake\Console\CommandRunner->run($argv = [0 => 'H:\\wamp64\\www\\contest\\adt-ardeche\\bin\\cake.php', 1 => 'i18n', 2*
*=> 'extract'], $io = ???) H:\wamp64\www\contest\adt-ardeche\bin\cake.php:12*
*0.0571 4761576 3. Cake\Http\BaseApplication->pluginConsole($commands = class Cake\Console\CommandCollection { protected $commands = ['help' => 'Cake\\Console\\Command\\HelpCommand', 'version' => 'Cake\\Command\\VersionCommand', 'cache clear' => 'Cake\\Command\\CacheClearCommand', 'cache clear_all' => 'Cake\\Command\\CacheClearallCommand', 'cache list' => 'Cake\\Command\\CacheListCommand', 'completion' => 'Cake\\Command\\CompletionCommand', 'i18n' => 'Cake\\Command\\I18nCommand', 'i18n extract' => 'Cake\\Command\\I18nExtractCommand', 'i18n init' => 'Cake\\Command\\I18nInitCommand', 'plugin assets copy' => 'Cake\\Command\\PluginAssetsCopyCommand', 'plugin assets remove' => 'Cake\\Command\\PluginAssetsRemoveCommand', 'plugin assets symlink' => 'Cake\\Command\\PluginAssetsSymlinkCommand', 'plugin load' => 'Cake\\Command\\PluginLoadCommand', 'plugin loaded' => 'Cake\\Command\\PluginLoadedCommand', 'plugin unload' => 'Cake\\Command\\PluginUnloadCommand', 'routes check' => 'Cake\\Command\\RoutesCheckCommand', 'routes' => 'Cake\\Command\\RoutesCommand', 'routes generate' => 'Cake\\Command\\RoutesGenerateCommand', 'schema_cache build' => 'Cake\\Command\\SchemacacheBuildCommand', 'schema_cache clear' => 'Cake\\Command\\SchemacacheClearCommand', 'server' => 'Cake\\Command\\ServerCommand', 'console' => 'App\\Command\\ConsoleCommand'] }) H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Console\CommandRunner.php:144*
*0.0571 4762424 4. Cake\Core\BasePlugin->console($commands = class Cake\Console\CommandCollection { protected $commands = ['help' => 'Cake\\Console\\Command\\HelpCommand', 'version' => 'Cake\\Command\\VersionCommand', 'cache clear' => 'Cake\\Command\\CacheClearCommand', 'cache clear_all' => 'Cake\\Command\\CacheClearallCommand', 'cache list' => 'Cake\\Command\\CacheListCommand', 'completion' => 'Cake\\Command\\CompletionCommand', 'i18n' => 'Cake\\Command\\I18nCommand', 'i18n extract' => 'Cake\\Command\\I18nExtractCommand', 'i18n init' => 'Cake\\Command\\I18nInitCommand', 'plugin assets copy' => 'Cake\\Command\\PluginAssetsCopyCommand', 'plugin assets remove' => 'Cake\\Command\\PluginAssetsRemoveCommand', 'plugin assets symlink' => 'Cake\\Command\\PluginAssetsSymlinkCommand', 'plugin load' => 'Cake\\Command\\PluginLoadCommand', 'plugin loaded' => 'Cake\\Command\\PluginLoadedCommand', 'plugin unload' => 'Cake\\Command\\PluginUnloadCommand', 'routes check' => 'Cake\\Command\\RoutesCheckCommand', 'routes' => 'Cake\\Command\\RoutesCommand', 'routes generate' => 'Cake\\Command\\RoutesGenerateCommand', 'schema_cache build' => 'Cake\\Command\\SchemacacheBuildCommand', 'schema_cache clear' => 'Cake\\Command\\SchemacacheClearCommand', 'server' => 'Cake\\Command\\ServerCommand', 'console' => 'App\\Command\\ConsoleCommand'] }) H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Http\BaseApplication.php:233*
*0.0571 4762424 5. Cake\Console\CommandCollection->discoverPlugin($plugin = 'Bake') H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Core\BasePlugin.php:281*
*0.0571 4762464 6. Cake\Console\CommandScanner->scanPlugin($plugin = 'Bake') H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Console\CommandCollection.php:180*
*0.0572 4762792 7. Cake\Console\CommandScanner->scanDir($path = 'H:\\wamp64\\www\\contest\\adt-ardeche/vendor/cakephp/bake/src\\Shell',*
*$namespace = 'Bake\\Shell\\', $prefix = 'bake.', $hide = []) H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Console\CommandScanner.php:96*
*0.0575 4769704 8. is_subclass_of($object_or_class = 'Bake\\Shell\\BakeShell', $class = 'Cake\\Console\\Shell') H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Console\CommandScanner.php:137*
*0.0575 4769824 9. Composer\Autoload\ClassLoader->loadClass($class = 'Bake\\Shell\\BakeShell') H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\cakephp\src\Console\CommandScanner.php:137*
*0.0577 4769952 10. Composer\Autoload\{closure:H:\wamp64\www\contest\adt-ardeche\vendor\composer\ClassLoader.php:575-577}($file = 'H:\\wamp64\\www\\contest\\adt-ardeche\\vendor\\composer/../cakephp/bake/src\\Shell\\BakeShell.php') H:\wamp64\www\contest\adt-ardeche\vendor\composer\ClassLoader.php:427*
*0.0581 4811920 11. include('H:\wamp64\www\contest\adt-ardeche\vendor\cakephp\bake\src\Shell\BakeShell.php') H:\wamp64\www\contest\adt-ardeche\vendor\composer\ClassLoader.php:576*