Hi,
Every time I try and launch a dmu-analyze mymodule, the analysis passes, but I get an error when generating the output. Here is the log:
drush dmu-analyze --path /path/to/mymodule mymodule
Indexing... done.
Error: Call to a member function setParser() on array in /var/www/html/src/vendor/twig/twig/src/Parser.php on line 100 #0 /var/www/html/src/web/vendor/twig/twig/src/Environment.php(563): Twig\Parser->parse(Object(Twig\TokenStream)) #1 /var/www/html/src/web/vendor/twig/twig/src/Environment.php(595): Twig\Environment->parse(Object(Twig\TokenStream)) #2 /var/www/html/src/web/vendor/twig/twig/src/Environment.php(408): Twig\Environment->compileSource(Object(Twig\Source)) #3 /var/www/html/src/web/vendor/twig/twig/src/Environment.php(381): Twig\Environment->loadClass('__TwigTemplate_...', 'modules/contrib...', NULL)
#4 /var/www/html/src/web/core/themes/engines/twig/twig.engine(64): Twig\Environment->loadTemplate('modules/contrib...') #5 /var/www/html/src/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('modules/contrib...', Array) #6 /var/www/html/src/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('dmu_report', Array)
#7 /var/www/html/src/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true) #8 /var/www/html/src/web/core/lib/Drupal/Core/Render/Renderer.php(139): Drupal\Core\Render\Renderer->render(Array, true) #9 /var/www/html/src/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#10 /var/www/html/src/web/core/lib/Drupal/Core/Render/Renderer.php(140): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /var/www/html/src/web/modules/contrib/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(135): Drupal\Core\Render\Renderer->renderRoot(Array)
#12 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->analyze('chosen_select_a...', Array)
#13 /var/www/html/src/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#14 /var/www/html/src/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData)) #15 /var/www/html/src/vendor/consolidation/annotated-command/src/CommandProcessor.php(178): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData)) #16 /var/www/html/src/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData)) #17 /var/www/html/src/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #18 /var/www/html/src/vendor/symfony/console/Application.php(987): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #20 /var/www/html/src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/src/web/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/src/web/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/src/web/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array) #24 /var/www/html/src/web/vendor/drush/drush/drush(4): require('/var/www/html/s...') #25 {main}
Comments
Comment #2
joshi.rohit100@rzb pls share the drush version , DMU module version and the module(if contrib) you are trying to convert.
Comment #3
joshi.rohit100Comment #4
steveoriolHello I think your error is because you don't have the same version of twig inside your two vendor:
/var/www/html/src/vendor/
and
/var/www/html/src/web/vendor/
Comment #5
rohitrajputsahab commentedI'm also facing the same issue. Please see the below.
drush dmu-upgrade pants
Indexing...
done.
[warning] Use of undefined constant MENU_CALLBACK - assumed 'MENU_CALLBACK' (this will throw an Error in a future version of PHP) HookMenu.php(73) : eval()'d code:11
[warning] Use of undefined constant MENU_NORMAL_ITEM - assumed 'MENU_NORMAL_ITEM' (this will throw an Error in a future version of PHP) HookMenu.php(73) : eval()'d code:21
[error] Error: Call to a member function setParser() on array in Twig\Parser->parse() (line 99 of /var/www/html/drupal8/vendor/twig/twig/src/Parser.php) #0 /home/lenovo/.composer/vendor/twig/twig/src/Environment.php(563): Twig\Parser->parse(Object(Twig\TokenStream))
#1 /home/lenovo/.composer/vendor/twig/twig/src/Environment.php(595): Twig\Environment->parse(Object(Twig\TokenStream))
#2 /home/lenovo/.composer/vendor/twig/twig/src/Environment.php(408): Twig\Environment->compileSource(Object(Twig\Source))
#3 /home/lenovo/.composer/vendor/twig/twig/src/Environment.php(381): Twig\Environment->loadClass('__TwigTemplate_...', 'modules/contrib...', NULL)
#4 /var/www/html/drupal8/core/themes/engines/twig/twig.engine(64): Twig\Environment->loadTemplate('modules/contrib...')
#5 /var/www/html/drupal8/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('modules/contrib...', Array)
#6 /var/www/html/drupal8/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('dmu_controller', Array)
#7 /var/www/html/drupal8/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true)
#8 /var/www/html/drupal8/core/lib/Drupal/Core/Render/Renderer.php(151): Drupal\Core\Render\Renderer->render(Array, true)
#9 /var/www/html/drupal8/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#10 /var/www/html/drupal8/core/lib/Drupal/Core/Render/Renderer.php(152): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/ConverterBase.php(197): Drupal\Core\Render\Renderer->renderPlain(Array)
#12 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php(238): Drupal\drupalmoduleupgrader\ConverterBase->parse(Array)
#13 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php(133): Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->getController(Object(Drupal\drupalmoduleupgrader\Target), Object(Drupal\drupalmoduleupgrader\Routing\Drupal7\RouteWrapper))
#14 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Routing/HookMenu.php(152): Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildRouteDefinition(Object(Drupal\drupalmoduleupgrader\Target), Object(Drupal\drupalmoduleupgrader\Routing\Drupal7\RouteWrapper))
#15 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Routing/HookMenu.php(107): Drupal\drupalmoduleupgrader\Routing\HookMenu->buildDestinationRoutes()
#16 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Routing/HookMenu.php(122): Drupal\drupalmoduleupgrader\Routing\HookMenu->getDestinationRoutes()
#17 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Links.php(91): Drupal\drupalmoduleupgrader\Routing\HookMenu->getDestinationRoute('admin/config/pe...')
#18 /var/www/html/drupal8/modules/contrib/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(181): Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Links->convert(Object(Drupal\drupalmoduleupgrader\Target))
#19 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->upgrade('pants', Array)
#20 /home/lenovo/.composer/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#21 /home/lenovo/.composer/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#22 /home/lenovo/.composer/vendor/consolidation/annotated-command/src/CommandProcessor.php(178): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#23 /home/lenovo/.composer/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#24 /var/www/html/drupal8/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/drupal8/vendor/symfony/console/Application.php(978): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/drupal8/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/drupal8/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/lenovo/.composer/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/lenovo/.composer/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /home/lenovo/.composer/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#31 /home/lenovo/.composer/vendor/drush/drush/drush(4): require('/home/lenovo/.c...')
#32 {main}.
Comment #6
steveoriol@rohit-drupal
Look to your version of twig for your 2 venor folder:
cd /var/www/html/drupal8 && composer show twig/twigand
cd /home/lenovo/.composer/ && composer show twig/twigif not the same version, You shoud ask for le version you need like that for "1.42.4":
cd /home/lenovo/.composer/ && composer require twig/twig:1.42.4Comment #7
rohitrajputsahab commentedComment #9
iarc13 commented#6 helped solve the issue! I wonder why changing the version of twig in .composer affected it.
Comment #10
liquidcms commentedmore composer nightmares....
what is the fix for this.. i have twig ver 2.12.3 in docroot and ver 1.42.4 in folder above docroot? Which is correct?