3

When upgrading from Devel 8.x-2.x to Devel 8.x-4.x in a composer based build, how do I handle the Kint module being removed per Remove Kint module and create a kint dumper plugin in devel?

The service container can't be created because the Kint class is missing. I'll add the class path to Kint when I blow up the build again. :) Thank you.

1
  • Did you try upgrading from 2 to 3, and then 3 to 4? Mar 9, 2021 at 2:24

3 Answers 3

7

Since Devel 4 you have to add Kint youself:

composer require drupal/devel kint-php/kint

You can read through this epic issue to learn more: Unknown "kint" function. in Twig\ExpressionParser.


Also important to read the release notes. On all 4.0.0+ releases the following is written. You have to do this before upgrading:

If you have Kint module enabled, please run these commands before upgrading:

  1. drush pm:uninstall kint or uninstall Kint using the Drupal UI
  2. composer require kint-php/kint

To fix any Kint-missing-module-error, simply downgrade Devel composer require 'drupal/devel:^2.1', uninstall Kint drush pmu kint and then upgrade again composer require drupal/devel kint-php/kint.

3
  • I've upgraded to 9 and updated devel before I uninstalled kint. I'm now stuck. When I try to enable other modules, I get this error: Drupal\Core\Extension\Exception\UnknownExtensionException: The module kint does not exist. Jun 8, 2021 at 12:13
  • 1
    @AbdulSadikYalcin – Downgrade like described in the last section of my post. Or create a bare bone custom module with just an info file. web/modules/custom/kint/kint.info.yml. Fill the info file, see drupal.org/docs/creating-custom-modules/…. Then run drush pmu kint, done.
    – leymannx
    Jun 8, 2021 at 16:37
  • Downgrading is not an option unfortunately. Done too much work to risk losing. I'll try creating a dummy kint module and see how it goes. Jun 18, 2021 at 16:41
1

The problem was I was including

// Change Kint maxLevels setting.
// @see https://gist.github.com/JPustkuchen/a5f1eaeb7058856b7ef087b028ffdfeb
include_once(DRUPAL_ROOT . '/modules/contrib/devel/kint/kint/Kint.class.php');
if (class_exists('Kint')) {
  Kint::$maxLevels = 6;
}

in settings.local.php. I recall reading somewhere that the default maxLevels in Kint is now 6 which makes the custom code snippet unnecessary. When I removed it, removed kint from core.extension.yml (in our case config_split.local) and added kint-php/kint via composer, all was well.

Thanks again @leymannx

1

If you are facing the issue.
Use the development module 4.x-dev
If you are using the 4+ versions then use development version 4.x-dev . https://www.drupal.org/project/devel

$ composer require drupal/devel:4.x-dev 
$ composer require kint-php/kint 
$ drush en -y devel

Enable Twig debugging it in development.services.yml file

twig.config:
    debug: true
    auto_reload: null
    cache: false

Goto /admin/config/development/devel and
set the "Variables dumper" to "Kint"

Add {{ kint() }} into template files.

2
  • 1
    Or just composer require drupal/devel_kint_extras && drush -y en devel_kint_extras. It gets the other dependencies automagically.
    – leymannx
    Nov 17, 2021 at 18:41
  • Thank you @leymannx Nov 18, 2021 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.