I'm in the process of attempting to setup a development environment for a Drupal site that's been provided by a vendor. From what I've been told, the sites been setup and running on our UAT (Ubuntu) machine following a pretty simple set of directions:

  • git clone
  • restore database
  • start services
  • drush cim -y
  • clear cache

(these may not be the actual steps, just want I was give).

The repository is updated with all composer dependencies, so my understanding is just pulling the same code and attempting to start it should work. So from my understanding (albeit limited composer/PHP experience) there should be no need for composer install/update as the folder structure should not need any changes.

I was instructed (or hinted) that setting up using Lando would be better for our team, than attempting to:

  • setup individual services
  • using AMPPS or something along those lines

which makes sense. I don't think there is anything really wrong with the Lando installation, but who knows at this point (PHP environments are not my strong suit).

Here is a copy of my lando.yml:

  • composer 1 is required, we were given dependencies that don't work with composer 2
  • Drush is working with this configuration
name: drupal8
recipe: drupal8
  webroot: docroot
  composer_version: '1.10.17'
    service: appserver
    cmd: php /app/vendor/drush/drush/drush --root=/app/docroot

After following the steps above:

  • Git clone
  • lando start (at this point lando has no issues)
  • lando db-import db/db-extract.sql (again no issues)
  • lando drush cim -y

I get the following (which is the same as if I go to the browser):

> lando drush cim -y
PHP Fatal error:  Trait 'Drupal\entity\Form\EntityDuplicateFormTrait' not found in /app/docroot/modules/contrib/commerce/modules/number_pattern/src/Form/NumberPatternForm.php on line 16

Fatal error: Trait 'Drupal\entity\Form\EntityDuplicateFormTrait' not found in /app/docroot/modules/contrib/commerce/modules/number_pattern/src/Form/NumberPatternForm.php on line 16
 [warning] Drush command terminated abnormally.

I found the following:

https://www.drupal.org/project/commerce/issues/3051402 (from 2015)

Which points at the issue being dependency related. So essentially we have:

  • drupal/commerce being installed as a dependency of drupal/commerce_print. It's not actually listed in the project main dependencies (unsure if this is an issue). It's being installed as drupal/commerce:2.24.0
  • drupal/entity and drupal/state_machine were configured as versions dev-1.x which (the link above) said was not good. I've since updated ONLY these two so that they are being installed as drupal/entity:1.0.0-rc2 and drupal/state_machine:1.0.0

After doing so, I'm still receiving the issue regarding PHP Fatal error: Trait 'Drupal\entity\Form\EntityDuplicateFormTrait' not found in /app/docroot/modules/contrib/commerce/modules/number_pattern/src/Form/NumberPatternForm.php on line 16 even though I can confirm that it is actually available with 1.0.0-rc2.

I'm assuming again that the DB is up to date, since it was provided to us to match the current repository (which I can only assume is right since again, it's working on UAT with none of these changes).

From what I've seen/read, these types of issues:

  • Are not actually what the problem is, and it's actually something else but throwing this nonesensical error. If this is the case, how does one go about finding the actual error?
  • There are still issues with dependencies installed, but again the UAT environment works out of the box with git clone, so why wouldn't these versions (in composer.lock) work locally?

Some other things that I've confirmed:

  • I'm able to connect to SQL through lando drush sqlc, so I assume that the $databases['default']['default'] is configured correctly. Please correct me if I'm wrong, but I've provided the database configuration settings from my local.settings.php file:
$lando = json_decode(getenv('LANDO_INFO'), TRUE);
$databases['default']['default'] = [
  'database' => $lando['database']['creds']['database'],
  'username' => $lando['database']['creds']['user'],
  'password' => $lando['database']['creds']['password'],
  'prefix' => '',
  'host' => $lando['database']['internal_connection']['host'],
  'port' => $lando['database']['internal_connection']['port'],
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
  // For whatever reason this won't work, even on docker/Lando.  Future kens problem.
  //'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',

I've attempted setting up the project without restoring the database. So following the steps:

  • git clone
  • lando start
  • drupal8.lndo.com:8000

which would always fail on the third step of the installation. It would result in the dependency of bartik_bartic_menu or something like that. I can start from scratch and provide more information if it's required.

Any help would be appreciated; I apologize in advance if I've overlooked providing something or completely missed the mark on following some basic steps on getting Drupal up and running.


I'm unsure if this matters, but here are the PHP modules installed in the Lando environment. If it's at all possible that there is PHP Trait or Autoloading functionality that doesn't work due to them (default Lando Drupal8 recipe):

[PHP Modules]
Zend OPcache

[Zend Modules]
Zend OPcache

Composer Autoload

One other thing I've noticed while looking around, there are files generated:

  • vendor/autoload.php
  • docroot/autoload.php

But there is no autoload section within the composer.json file. Although I'm assuming it works, or else there would probably be way more earlier Cannot find class errors?

In comparison to what is working, there is no autoload section in the working composer.json so I'm not sure, here is the EXTRA section, which provides some drupal specific configuration (I guess) if it's helpful:

  • setup.sh does some stuff with Docker when a .dockerfile is there (not the case)
  • The rest, I have zero idea.
    "extra": {
        "scripts-dev": {
            "post-install-cmd": [
                "sh ./scripts/tools/setup.sh"
        "drupal-scaffold": {
            "locations": {
                "web-root": "./docroot"
            "file-mapping": {
                "[web-root]/.htaccess": {
                    "mode": "replace",
                    "path": "docroot/.htaccess",
                    "overwrite": false
        "merge-plugin": {
            "include": [
            "recurse": true,
            "replace": false,
            "ignore-duplicates": false,
            "merge-dev": true,
            "merge-extra": false,
            "merge-extra-deep": false,
            "merge-scripts": false
        "installer-paths": {
            "docroot/core": [
            "docroot/modules/contrib/{$name}": [
            "docroot/profiles/contrib/{$name}": [
            "docroot/themes/contrib/{$name}": [
            "docroot/libraries/{$name}": [
            "drush/contrib/{$name}": [

Edit May 10

I was able to get the basic/standard install going by removing the Database configuration from the settings.php file and running the install from scratch. Once this was completed I replaced the autogenerated database config with the above config for lando; after restarting the site basic/standard site is up and running.

I then ran lando db-import as mentioned above and that completed successfully.

Sadly, I'm still back to the error message (above).

Edit May 10 x 2

Ok so apparently lando composer install works "correctly" and there are no issues, but when looking into the structure a little more (I apologize, I should have done this way earlier) the docroot/modules/contrib/entity folder is empty.

I'm not sure if this is an issue with:

  • Composer
  • Composer drupal scaffold
  • Etc.

If I delete the /vendor folder, which this module isn't even a part of, it will do the full install again, but it again leaves the docroot/modules/contrib/entity folder empty.

Looking in the repository, there isn't even a docroot/modules/contrib/entity folder. After:

  • Removing the entity folder
  • Re-running lando composer install the entity folder is now populated and the EntityDuplicateFormTrait is there

After attempting to clear cache or access the site I'm now getting the error

PHP Fatal error:  Uncaught Drupal\Component\Plugin\Exception\PluginNotFoundException: The "state" plugin does not exist. Valid plugin IDs for Drupal\Core\Field\FieldTypePluginManager are: address, address_country, address_zone, color_field_type, comment, commerce_plugin_item:commerce_condition, commerce_plugin_item:commerce_promotion_offer, commerce_plugin_item:commerce_shipping_method, commerce_remote_id, commerce_adjustment, commerce_price, commerce_shipment_item, commerce_tax_number, datetime, daterange, entity_reference_revisions, file, file_uri, google_map_field, image, layout_section, link, metatag, list_float, list_integer, list_string, path, physical_dimensions, physical_measurement, redirect_source, telephone, text, text_long, text_with_summary, webform, yoast_seo, boolean, changed, created, decimal, email, entity_reference, float, integer, language, map, password, string, string_long, timestamp, uri, uuid in /app/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:53

Edit May 10x3

So after playing around a little more, it looks like NONE of the dependencies in the provided composer.json file that are listed as 1.x-dev have been installed. They are also missing in the git repository, even though every other single dependency folder is there and complete.

So somehow:

  • They are not in the .gitignore file
  • They are all listed as 1.x-dev regardless of whether this is good practice or not (which I doubt)
  • And they are all missing in the repository and require an extra delete/install step to get them working.

I've done a quick search for this, but can't find anything meaningful in the short time, if someone can point me in the right direction I'd be greatful.

  • 1
    Have you tried simply lando drush cr before lando drush cim? Also if the DB is up to date the cim is at best unnecessary
    – Clive
    Apr 22, 2021 at 22:04
  • Hey thanks man. I have attempted the clear cache and cache rebuild. Both result in the same error. I didn't think I had to, but just following instructions provided. Appreciate the note. I'm curious if its a php extension or something, but I don't know where to start (logging, etc) Apr 22, 2021 at 22:22
  • 1
    Try running composer install perhaps a file is missing.
    – No Sssweat
    Apr 26, 2021 at 9:37
  • Have run composer install a couple times. Originally the issue with this was that running composer install once would remove core/drupal then running it again would bring it back. This was resolved by changing the composer timeout. But anyhow, I can confirm that the dependency in question drupal/entity:1.0.0 is there (although the UAT site works with drupal/entity:dev-1.0 which also contains the file in question. Unless some other module is missing, and the error just makes no sense then. Apr 26, 2021 at 14:02
  • +1 just for the richness of detail 🤗
    – leymannx
    May 11, 2021 at 15:01

2 Answers 2


This may not be the appropriate answer, but the environment is up and running now (partially due to my own inexperience) but I thought I should share. So the problem was indeed as simple as running lando composer install a number of times.

  • Checkout project from git. The git project contains ALL the vendor dependencies except the three: drupal/poll, drupal/state_machine and drupal/entity. Composer is git cloning modules instead of download them?
  • Running lando composer install updates these with blank folders and says that it completes successfully

from here, I needed to:

  • Individually delete the docroot/modules/contrib/entity|poll|state_machine directories and run lando composer install again

at this point I had these three folders containing their respective projects. Finally I was able to run lando drush cr without errors. After which, I was able to access the drupal site home page.

I have more testing to do, in figuring out how to streamline the dev environment and settings.php file(s) but at lease this issue seems fixed.


If you are not installing commerce via composer, then you still need the dependencies to commerce

Commerce has a composer.lock file

    "require": {
    "php": "^8.0",
    "ext-bcmath": "*",
    "drupal/core": "^9.3 || ^10",
    "drupal/address": "^1.7",
    "drupal/entity": "^1.0",
    "drupal/entity_reference_revisions": "~1.0",
    "drupal/inline_entity_form": "^1.0@RC",
    "drupal/profile": "^1.2",
    "drupal/state_machine": "^1.5",
    "drupal/token": "^1.7",
    "commerceguys/intl": "^2.0.2"

The composer merge plugin can be used, with this exerpt from composer.json showing the included composer file

    "extra": {
    "merge-plugin": {
        "include": [

Your Answer

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

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