migration – error on CLI when using drush config-import staging

I’m getting this error below whenever I try executing the commands drush config-import staging on the CLI. I’m basically in the process of migrating a drupal 7 DB to Drupal 8 and currently following this guide since I’m still new with migration.


DrupalCoreConfigConfigImporterException: There were errors validating the config synchronization. in         (error)
DrupalCoreConfigConfigImporter->validate() (line 728 of
/Applications/XAMPP/xamppfiles/htdocs/drupal-eight-iom/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons:                                                                (error)
Site UUID in source storage does not match the target storage.
Entities exist of type <em class="placeholder">Shortcut link</em> and <em class="placeholder">Shortcut set</em>
<em class="placeholder">Default</em>. These entities need to be deleted before importing.
The core.extension configuration does not exist.
Can not uninstall the Configuration module as part of a configuration synchronization through the user
interface.

$databases('default')('default') = array (
  'database' => 'drupal-eight-iom',
  'username' => 'root',
  'password' => '',
  'prefix' => '',
  'host' => '127.0.0.1',
  'port' => '3306',
  'namespace' => 'Drupal\Core\Database\Driver\mysql',
  'driver' => 'mysql',
);

$databases('upgrade')('default') = array (
    'database' => 'drupal-seven-iom',
    'username' => 'root',
    'password' => '',
    'prefix' => '',
    'host' => '127.0.0.1',
    'port' => '3306',
    'namespace' => 'Drupal\Core\Database\Driver\mysql',
    'driver' => 'mysql',
  );


$settings('install_profile') = 'standard';
$config_directories('staging') = 'sites/default/config';
$config_directories('sync') = 'sites/default/files/config_zB_DnNUK68i5Owp5a8FzTiClQfp3d3jrwcy0_HuS1hNCGv9Y_Iva2Ahm8LCH-P0j0M2jwmQAsA/sync';

8 – How can I use Drush in a project installed with Composer?

Just an addition for windows users.

lesley n. answer above works just fine for Windows users as well.

Just edit C:Usersyour_username.bash_profile and add one line:

alias drush='vendor/bin/drush'

Restart your Git Bash, go to your drupal site home folder and try:

drush version

It should work

I was able to make composer-installed Drupal Console to work with only “drupal” command also with one line addition to C:Usersyour_username.bash_profile as well:

alias drupal='vendor/bin/drupal'

Restart your Git Bash, go to your drupal site home folder and try:

drupal --version

This should work as well.

These two solutions are much easier for me than installing Drush Launcher and Console Launcher on my Windows platform.

drush – How to overcome error caused by non-existent service “entity.manager”?

Seems like Drush which came with the setup was not fully compatible.
I installed it again using the composer using

composer require drush/drush

It is working as expected.

Here is updated “require” section looks like in composer.json

   "require": {
        "composer/installers": "^1.9",
        "drupal/bootstrap_barrio": "^4.28",
        "drupal/bootstrap_sass": "^1.12",
        "drupal/core-composer-scaffold": "^9",
        "drupal/core-project-message": "^9",
        "drupal/core-recommended": "^9",
        "drush/drush": "^10.2"
    },

Drush 10, Drupal 9, views-bulk-operations:execute using entity:delete_action:node seems to work but won’t save its changes

I’m trying a command:
drush -vvv views-bulk-operations:execute -d deleteme_content entity:delete_action:node

where deleteme_content is a View with translations of entities that I want to delete. The command appears to work and prints a success message but the content is not actually deleted.

I’ve traced all the way into drupal/core/lib/Drupal/Core/Action/Plugin/Action/DeleteAction.php where I added some temporary logging messages and see in executeMultiple() that the desired entities are being changed in $this->tempStore.

So it looks to me like the changes are being made in tempStore but then not being “committed” to the permanent storage. I have looked for a “commit” type option in both drush and the vbo-execute command for drush and don’t see anything.

Can anyone provide a clue?

drush – Drupal root not found. Pass –root or a @siteAlias in order to see Drupal-specific commands

I have multiple sites inside the same htdocs directory. In one, I removed all the folders except vendor under Web. Now drush will not work (it worked before I moved the folders). But now, it cannot find the database, which is correctly defined in web/sites/default/settings.php

/srv/www/htdocs/jar/drupal # ./drush status
 PHP binary    : /usr/bin/php
 PHP config    : /srv/www/php.ini
 PHP OS        : Linux
 Drush script  : /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush
 Drush version : 10.3.6
 Drush temp    : /tmp
 Drush configs : /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush.yml
 Drupal root   : /srv/www/htdocs/jar/drupal

I am running Drupal 9.0.8 and drush 10.3.6 (in /srv/www/htdocs/jar/drupal). I have removed drush using composer (2.0.3) and reinstalled it (recreating vendor in the process).

/srv/www/htdocs/jar/drupal # ./drush -vvv cr
 (preflight) Config paths: /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush.yml
 (preflight) Alias paths: /srv/www/htdocs/jar/drupal/drush/sites,/srv/www/htdocs/jar/drush/sites
 (preflight) Commandfile search paths: /srv/www/htdocs/jar/drupal/vendor/drush/drush/src
 (debug) Starting bootstrap to site (0.04 sec, 8.17 MB)

In BootstrapHook.php line 32:
  (Exception)
  Bootstrap failed. Run your command with -vvv for more information.
Exception trace:
  at /srv/www/htdocs/jar/drupal/vendor/drush/drush/src/Boot/BootstrapHook.php:32
 DrushBootBootstrapHook->initialize() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44
 ConsolidationAnnotatedCommandHooksDispatchersInitializeHookDispatcher->doInitializeHook() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36
 ConsolidationAnnotatedCommandHooksDispatchersInitializeHookDispatcher->callInitializeHook() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29
 ConsolidationAnnotatedCommandHooksDispatchersInitializeHookDispatcher->initialize() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
 ConsolidationAnnotatedCommandCommandProcessor->initializeHook() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:296
 ConsolidationAnnotatedCommandAnnotatedCommand->initialize() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Command/Command.php:221
 SymfonyComponentConsoleCommandCommand->run() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Application.php:1018
 SymfonyComponentConsoleApplication->doRunCommand() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Application.php:271
 SymfonyComponentConsoleApplication->doRun() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Application.php:147
 SymfonyComponentConsoleApplication->run() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/src/Runtime/Runtime.php:118
 DrushRuntimeRuntime->doRun() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/src/Runtime/Runtime.php:49
 DrushRuntimeRuntime->run() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush.php:72
 require() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush:4

I looked at all the above suggestions, but am stuck. Drush works perfectly on my other 5 sites…

7 – Drush on server: Error: Allowed memory size issue

I have Drush installed on my Inmotion hosting server.
For one Drupal 7 site, it works just fine but for the other one, which is nearly identical, it doesn’t work so well.
Some commands it allows (like my favourite drush sql-dump or drush cc followed by 5) and but when I do a command drush cc all it throws an out-of-memory issue as shown below:

Drush command terminated abnormally due to an unrecoverable error.                                                                         (error)
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in
/home/myAccount/public_html/mysite.net/sites/all/modules/views/includes/base.inc, line 129

The issues stemming from the base.inc file are:

after command: drush cc all: on line 129:
$storage($option) = isset($definition('default')) ? $definition('default') : NULL;

The issues stemming from the view.inc file are:

after command: drush cc all: on line 2244:
$this->$field = unserialize($info('serialized default'));

after command: drush cc all: on line 2312:
$this->$field = empty($info('serialize')) ? $data->$field : unserialize($data->$field);

The php.ini files are identical on both sites.
The settings.php files are not identical and I thought it would be resolved by adding the same lines to the ending of the file

ini_set('memory_limit', '512M');
error_reporting(E_ALL);
$conf('error_level') = 2;
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

but this didn’t solve the problem (even after clearing the cache).

What could cause this problem?

drush – Why is the –uri option needed to return absolute URLs?

I want to execute a View and export the JSON file to the files directory. I am using Views Data Export and VDE drush add-on modules. My view has a file/PDF field and I want to provide a direct link to the PDF file. So I added a Views relation for the field and a file URI formatter field. When I go to see the output the View creates at the Path. The URL is an absolute link directly to the PDF file. The URL includes the domain name when viewing it on development or production instances. And this is what I want. This is the correct URL path in the JSON:

href=u0022http://mysite.com/files/Allergens.pdf

But when I use this Drush command below provided by views_data_export or vde_drush

drush vde myview myviewid myfile.json 

the domain name is stripped out like this:

href=u0022http://default/files/Allergens.pdf

Why is this happening only when using the Drush command? I found I can fix it by adding this at the end of the command

--uri=mysite.com

So my new drush command looks like this:

drush vde myview myviewid myfile.json --uri=mysite.com

But doing this will hardcode the domain name into the URL. I want the URL to work on development, production and on my local. Thank you for any help you can provide.

9 – Issues with Drush 10.3.5 version in Ubuntu 20.04

I installed Drush 10.3.5 version via composer in Drupal 9.0.7 but I am getting a website error as follows after I ran command drush cache-rebuild. I can not access the admin page as well.

The website encountered an unexpected error. Please try again later.
Error: Class ‘DrushLogDrushLog’ not found in DrupalComponentDependencyInjectionContainer->createService() (line 257 of core/lib/Drupal/Component/DependencyInjection/Container.php).

I found somewhere i.e. (https://gorannikolovski.com/blog/drupal-9-and-drush-10) that Drush does not support symfony/var-dumper version 5.*. But I can’t change symfony/var-dumper version in Drupal because Drupal core requires symfony/var-dumper v5.1.10 as follows:

$ composer why symfony/var-dumper

drupal/core-recommended 9.0.7 requires symfony/var-dumper (v5.1.0)
symfony/error-handler v4.4.9 requires symfony/var-dumper (^4.4|^5.0)

So please help me to fix this issue.

Please let me know which Drush version I should use with the latest
Drupal version 9.0.7.

The website issue screenshot as follows:

enter image description here

Also how to fix this website issue so that I can see the front page
and admin page.

Thank You

composer – Issues with Drush 10.3.5 version with Drupal 9.0.7 version in Ubuntu 20.04

I installed Drush 10.3.5 version via composer in Drupal 9.0.7 but I am getting a website error as follows after I ran command drush cache-rebuild. I can not access the admin page as well.

The website encountered an unexpected error. Please try again later.
Error: Class ‘DrushLogDrushLog’ not found in DrupalComponentDependencyInjectionContainer->createService() (line 257 of core/lib/Drupal/Component/DependencyInjection/Container.php).

I found somewhere i.e. (https://gorannikolovski.com/blog/drupal-9-and-drush-10) that Drush does not support symfony/var-dumper version 5.*. But I can’t change symfony/var-dumper version in Drupal because Drupal core requires symfony/var-dumper v5.1.10 as follows:

$ composer why symfony/var-dumper

drupal/core-recommended 9.0.7 requires symfony/var-dumper (v5.1.0)
symfony/error-handler v4.4.9 requires symfony/var-dumper (^4.4|^5.0)

So please help me to fix this issue.

Please let me know which Drush version I should use with the latest
Drupal version 9.0.7.

The website issue screenshot as follows:

enter image description here

Also how to fix this website issue so that I can see the front page
and admin page.

Thank You