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
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 'DrupalentityFormEntityDuplicateFormTrait' not found in /app/docroot/modules/contrib/commerce/modules/number_pattern/src/Form/NumberPatternForm.php on line 16
Fatal error: Trait 'DrupalentityFormEntityDuplicateFormTrait' 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/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
After doing so, I’m still receiving the issue regarding
PHP Fatal error: Trait 'DrupalentityFormEntityDuplicateFormTrait' 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
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
$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
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.