1

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"
        }
      }
    }
],

and the composer.json file from the custom module looks as below :

{
    "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 the following 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, the re 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 min imum-stability setting see https://getcomposer.org/doc/04-schema.md#minimum-stability for more det ails. - 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 commo n problems.

But on Drupal.org I can find the module with that version here

Please help me to solve the issue.

1
  • Try to use vcs repository instead of package - package has man limitations and constantly confuses people. Commented Feb 11, 2019 at 9:14

1 Answer 1

0

Try this:

Root composer.json section

 "repositories": [
    {
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    },
    {
      "type": "vcs",
      "url": "[email protected]:username/custom-module"
    }
  ],

Module composer.json example that has two modules as dependency

{
  "name": "username/custom-module",
  "version": "1.2.3",
  "type": "drupal-custom-module",
  "description": "Custom module",
  "keywords": ["Drupal"],
  "license": "GPL-2.0+",
  "minimum-stability": "dev",
  "repositories": [
    {
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    }
  ],
  "require": {
    "drupal/admin_toolbar": ">=1.2",
    "drupal/chosen": ">=2.6"
  }
}
Sign up to request clarification or add additional context in comments.

3 Comments

thanks for answering but still same issue, dependent modules are not being rendered.
@miststudent2011 what do you mean by "not being rendered"? Not downloaded?
@miststudent2011 the structure I posted should be correct, but it might be something else. Can you plese share your updated code (the project and module composer?). Also can you try to clear composer cache (composer clear-cache) and confirm that your module are not in vednor folder after you requre it again?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.