I have transfered locally (on a Wampserver with PHP 8.1.13 on Windows 10) a backup version of my existing Drupal 9 website. The files are on a subfolder C:/wamp64/www/BDV-dev. I have created a database ("bdv_dev") and I have edited settings.php to link it :
$databases['default']['default'] = array (
'database' => 'bdv_dev',
'username' => 'root',
'password' => '',
'prefix' => '',
'host' => 'localhost',
'port' => '3306',
'driver' => 'mysql',
'collation' => 'utf8mb4_general_ci',
'init_commands' => [
'isolation_level' => 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
],
);
When connecting to my website locally (virtual-host correctly configured on Wamp), it asked my to run the install process which was successfull.
Then I tried to import my existing database backup (file "dev.sql" in my subfolder project) with the command "drush sql-cli < dev.sql" but I have the following error message :
[preflight] Package "drupal/core" is not installedIt happens with all drush commands (status, cr, etc) and I can’t find anything about this particular error message…
I have updated all modules / extensions with "composer update -W".
Here is my composer.json file :
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"commerceguys/addressing": "^1.4",
"composer/installers": "^2.2",
"cweagans/composer-patches": "^1.7",
"doctrine/collections": "^1.2",
"drupal/address": "^1.11",
"drupal/address_autocomplete": "^1.0@beta",
"drupal/admin_toolbar": "^3.3",
"drupal/adminimal_theme": "^1.6",
"drupal/allowed_formats": "^2.0",
"drupal/antibot": "^2.0",
"drupal/asset_injector": "^2.13",
"drupal/backup_migrate": "^5.0",
"drupal/better_exposed_filters": "^6.0",
"drupal/block_class": "^2.0",
"drupal/bootstrap_layouts": "^5.2",
"drupal/bootstrap_paragraphs": "^2.0@beta",
"drupal/cer": "^5",
"drupal/chosen": "^3.0",
"drupal/chosen_field": "^3.0",
"drupal/chosen_lib": "^3.0",
"drupal/ckeditor_resize": "^1.3",
"drupal/ckeditor_specialchars": "^1.2",
"drupal/clientside_validation": "^4.0",
"drupal/clientside_validation_jquery": "^4.0",
"drupal/cocoen_beforeafter": "^1.1",
"drupal/color_field": "^3.0",
"drupal/colorbox": "^2.0",
"drupal/colorbox_load": "^1.2",
"drupal/conditional_fields": "^4.0@alpha",
"drupal/config_update": "^1.7",
"drupal/cookies": "^1.2",
"drupal/cookies_ga": "^1.2",
"drupal/core-composer-scaffold": "^9.5",
"drupal/core-project-message": "^9.5",
"drupal/core-recommended": "^9.5",
"drupal/ctools": "^4.0",
"drupal/db_maintenance": "^2.0",
"drupal/dropdown_language": "^3.1",
"drupal/ds": "^3.15",
"drupal/ds_extras": "^3.15",
"drupal/editablefields": "^1.0",
"drupal/entity_usage": "^2.0@beta",
"drupal/features": "^3.12",
"drupal/feeds": "^3.0@beta",
"drupal/feeds_tamper": "^2.0@beta",
"drupal/field_group": "^3.4",
"drupal/field_group_bootstrap": "^3.0",
"drupal/field_group_table": "^1.0",
"drupal/field_permissions": "^1.2",
"drupal/focal_point": "^1.5",
"drupal/fontawesome": "^2.25",
"drupal/geofield": "^1.47",
"drupal/google_analytics": "^4.0",
"drupal/honeypot": "^2.1",
"drupal/image_effects": "^3.4",
"drupal/image_url_formatter": "^1.0",
"drupal/imagelightbox": "^2.1",
"drupal/imagemagick": "^3.4",
"drupal/imagick": "^1.6",
"drupal/imce": "^3.0",
"drupal/jquery_colorpicker": "^3.0",
"drupal/jquery_ui": "^1.6",
"drupal/jquery_ui_checkboxradio": "^2.0",
"drupal/jquery_ui_slider": "^2.0",
"drupal/jquery_ui_tabs": "^2.0",
"drupal/jquery_ui_tooltip": "*",
"drupal/jquery_ui_touch_punch": "^1.1",
"drupal/krypt": "^1.0",
"drupal/leaflet": "^10.0",
"drupal/leaflet_geojson": "^1.6",
"drupal/leaflet_layers": "^1.1",
"drupal/leaflet_more_maps": "^2.1",
"drupal/leaflet_views": "^10.0",
"drupal/magnific_popup": "^1.5",
"drupal/mailchimp": "^2.0",
"drupal/mailsystem": "^4.4",
"drupal/masonry": "^1.2",
"drupal/masonry_views": "^1.1",
"drupal/mediteran": "^1.29",
"drupal/menu_block": "^1.10",
"drupal/metatag": "^1.22",
"drupal/metatag_dc": "^1.22",
"drupal/metatag_facebook": "^1.22",
"drupal/metatag_google_cse": "^1.22",
"drupal/metatag_open_graph": "^1.22",
"drupal/metatag_pinterest": "^1.22",
"drupal/metatag_twitter_cards": "^1.22",
"drupal/metatag_verification": "^1.22",
"drupal/metatag_views": "^1.22",
"drupal/ng_lightbox": "^2.0@beta",
"drupal/node_export": "^1.0@alpha",
"drupal/paragraphs": "^1.15",
"drupal/paragraphs_sets": "^2.8",
"drupal/pathauto": "^1.11",
"drupal/pcr": "^1.4",
"drupal/phoney": "^1.0",
"drupal/phpmailer_smtp": "^2.1",
"drupal/quick_node_clone": "^1.15",
"drupal/rabbit_hole": "^1.0@beta",
"drupal/redirect": "^1.8",
"drupal/redirect_404": "^1.8",
"drupal/rh_node": "^1.0@beta",
"drupal/schema_metatag": "^2.4",
"drupal/selective_better_exposed_filters": "^3.0@beta",
"drupal/shariff": "^1.7",
"drupal/simple_popup_views": "^1.2",
"drupal/svg_image": "^1.16",
"drupal/svg_image_responsive": "^1.16",
"drupal/svg_pan_zoom": "^1.0@beta",
"drupal/taxonomy_bulk_actions": "^1.0",
"drupal/token": "^1.11",
"drupal/tooltip": "*",
"drupal/tooltip_ckeditor": "^4.0",
"drupal/transliterate_filenames": "^2.0",
"drupal/unmanaged_files": "^1.0",
"drupal/upgrade_status": "^3.18",
"drupal/vbo_export": "^4.1",
"drupal/views_bootstrap": "^5.4",
"drupal/views_conditional": "^1.5",
"drupal/views_contextual_filters_or": "^1.4",
"drupal/views_data_export": "^1.3",
"drupal/views_delimited_list": "^2.0@alpha",
"drupal/views_entity_form_field": "^1.0@beta",
"drupal/views_exposed_filter_blocks": "^1.1",
"drupal/views_geojson": "^1.2",
"drupal/views_infinite_scroll": "^2.0",
"drupal/views_merge_rows": "^2.3",
"drupal/viewsreference": "^2.0@beta",
"drupal/webform": "^6.1",
"drupal/webform_attachment": "^6.1",
"drupal/webform_bootstrap": "^6.1",
"drupal/webform_clientside_validation": "^6.1",
"drupal/webform_icheck": "^6.1",
"drupal/webform_jqueryui_buttons": "^6.1",
"drupal/webform_location_geocomplete": "^6.1",
"drupal/webform_options_custom": "^6.1",
"drupal/webform_options_limit": "^6.1",
"drupal/webform_postcodeapi": "^1.5",
"drupal/webform_submission_export_import": "^6.1",
"drupal/webform_submission_log": "^6.1",
"drupal/webform_ui": "^6.1",
"drupal/webform_views": "^5.0",
"drupal/xmlsitemap": "^1.4",
"drupal/xmlsitemap_custom": "^1.4",
"drupal/xmlsitemap_engines": "^1.4",
"drupal/zurb_twentytwenty": "^2.0",
"drush/drush": "^11.6",
"league/csv": "^9.8",
"phayes/geophp": "^1.2",
"phpmailer/phpmailer": "^6.7",
"roave/better-reflection": "^6.5"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true,
"cweagans/composer-patches": true
},
"sort-packages": true,
"process-timeout":0
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"],
"web/modules/custom/{$name}": ["type:drupal-custom-module"],
"web/profiles/custom/{$name}": ["type:drupal-custom-profile"],
"web/themes/custom/{$name}": ["type:drupal-custom-theme"]
},
"drupal-core-project-message": {
"include-keys": ["homepage", "support"],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/installing-drupal",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
},
"patches": {
}
},
"require-dev": {
"drupal/core-dev": "^9.5"
}
}
I also tried "drush status" locally on Xampp and I am experiencing the same error message.
I really can’t see what is happening here…
2
Answers
It seems I have found a solution (at least temporarily): I have just added my drush project folder ($PROJECT/vendor/drush/drush) to my Windows $PATH, re-launched my terminal Cmder and now commands like "drush status" no longer throws error messages!
This is not a Windows answer, but may help someone on Linux that gets this message. I also had this issue when I moved to Drupal 9. The newer versions of Drush need to have the Drupal scaffold in the composer project or you will get that error.
I have a ‘minimal’ composer.json that just has one of my Drupal projects D10 composer.json with all the modules taken out (just to save space)
Here is a link to my composer.json that just does Drush for me. I have a couple of other Drush versions and they are installed (as recommended) on a per project basis in their respective directories.
Drush 12 Composer file
I have this in the root of my home directory. You can export the path in your bashrc to make it easier to access.
I’m sure it can probably be optimised and I’ll leave that to the experts like leymannx.