Score:0

My custom module shows up on the modules list but I cannot enable it, why?

mu flag

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
Jaypan avatar
de flag
What is your folder structure? What does [MODULE].info.yml look like?
Score:3
us flag

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.)

acey avatar
mu flag
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!
apaderno avatar
us flag
Did you install the *Http Client* module?
acey avatar
mu flag
I did, still doesn't work!
apaderno avatar
us flag
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.)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.