Hi I am trying to setup my new Drupal 8 site with composer, but I got few issues.
I tried to setup the site site by following the Guide from here and was able to setup the site successfully.
After that I tried to install a custom module which is hosted on Bitbucket and I am able to download the package using Composer, but the problem is the module has some other contributed module dependency but the dependency module is not downloaded along with the custom module.
I followed the guide from here and added composer.json file to my custom module along with the dependency, but after running composer require custom/custom_module
only the custom module is installed but not the dependency.
My root directory composer.json file repositories section looks like this.
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "package",
"package": {
"name": "custom/custom_module",
"version": "master",
"type": "drupal-custom-module",
"source": {
"type": "git",
"url": "[email protected]:username/custom-module.git",
"reference": "master"
}
}
}
],
The composer.json file from the custom module is the following.
{
"name": "custom/custom_module",
"description": "This is a Custom Module with Different functionalities.",
"type": "drupal-custom-module",
"minimum-stability": "dev",
"require": {
"drupal/restui": "~1.16"
}
}
I also chaged the line "drupal/restui": "~1.16"
as "drupal/restui": "^1.16"
but with no success.
I even tried running composer update
in the custom module directory as I was not sure whether dependencies will be installed along with custom module.
After running composer update
in the custom module directory I got this error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package drupal/restui could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see https://getcomposer.org/doc/04-schema.md#minimum-stability for more details.
- It's a private package and you forgot to add a custom repository to find it
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
On Drupal.org I can find the module with that version here.
EDIT 1
I have added below to the composer.json file from the custom module but still same issue.
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
EDIT 2 : Seems recursive package download is not possible with composer. Refer Why can't Composer load repositories recursively? and Add support for installing libraries via asset-packagist