0

I've written a custom module (custom_data_import) with a .info.yml file and .module files, but the module only shows up in my list of modules and I cannot enable it. Moreover, the .module file seems to act like a plain text file. Can someone please help?

The content of the custom_data_import.info.yml file is the following.

name: 'Custom Data Import'
type: module
description: 'Custom module to import JSON data'
package: Custom
core_version_requirement: ^8 || ^9
dependencies:
  - drupal: node
  - drupal: http_client
1
  • What is your folder structure? What does [MODULE].info.yml look like?
    – Jaypan
    Jul 14, 2023 at 4:36

1 Answer 1

3

The dependencies are not correct. The Http Client module is not a Drupal core module; that means it can be declared as dependency as http_client:http_client, not drupal:http_client. (There must be no space before or after colons.)

The dependency format is <project machine name>:<module machine name>. The project machine name is the last part in the project page URL, https://www.drupal.org/project/http_client for the Http Client module and https://www.drupal.org/project/drupal for Drupal core.

Since you are defining the dependency as drupal:http_client, and since Drupal doesn't find any Drupal core module with that machine name, Drupal does not allow you to install your custom module because one of the dependencies is missing. (As far as I recall, it should show a note about the missing dependency in the module description.)

4
  • Thanks so much! That was a terrible oversight on my part, but I changed it now. However, the module now doesn't appear on the list at all!
    – acey
    Jul 14, 2023 at 7:41
  • Did you install the Http Client module?
    – apaderno
    Jul 14, 2023 at 7:43
  • I did, still doesn't work!
    – acey
    Jul 14, 2023 at 8:20
  • If you edited the .info.yml which is already copied on the server, Drupal probably did not notice the change. (Keep in mind that some information is cached by Drupal.)
    – apaderno
    Jul 14, 2023 at 9:24

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.