I'm new to Composer and Github. I have installed a Drupal locally using Composer and then pushed my code to my Development and Production Server using Github Action CI/CD.
I had successfully installed Composer on the development server. I want to install a new module in Drupal.
Correct me if I am wrong. I was trying to update composer.json first and then run composer install.
So I have updated composer.json with require
"drupal/social_media_links": "^2.9",
Within a Github action
I get the following output:
Run composer install if composer.json exists
Run composer validate --no-check-publish && composer install --prefer-dist --no-progress
8./composer.json is valid but your composer.lock has some errors
9# Lock file errors
10- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.
11- Required package "drupal/smtp" is not present in the lock file.
12- Required package "drupal/social_media_links" is not present in the lock file.
13This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.
14Read more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md
15and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r
16Error: Process completed with exit code 2.
![]()
My question is
1)Do I have to update composer.lock along with composer.json?
2)Am I missing the steps while adding new module?
Comments
This sounds more like a
This sounds more like a Github action problem then a Drupal problem. You'll be more likely to get an answer there. Adding a Drupal module with composer is no different than adding any other library with composer, so the fact that it is a Drupal modules you are adding will not require any additional context for them to provide you with support.
Contact me to contract me for D7 -> D10/11 migrations.
What are the best practice to
What are the best practice to add module
1) upload through github actions or
2) upload through composer?