问题1:
Drupal10下载模块时,官方更推荐使用composer下载安装。因为一些模块会有很多依赖,手动下载较为麻烦,而composer则会将依赖模块一并下载。
而在使用composer下载时会出现以下错误:
root@f6e5485502e2:/opt/drupal# composer require 'drupal/yunke_help:^2.4'
./composer.json has been updated
Running composer update drupal/yunke_help
Loading composer repositories with package information
https://packages.drupal.org/8 could not be fully loaded (curl error 28 while downloading https://packages.drupal.org/8/packages.json: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received), package information was loaded from the local cache and may be out of date
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
47 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Endroid Installer did not detect a specific framework for auto-configuration
https://repo.packagist.org could not be fully loaded (curl error 28 while downloading https://repo.packagist.org/p2/composer/installers.json: Failed to connect to repo.packagist.org port 443: Connection timed out), package information was loaded from the local cache and may be out of date
Failed to audit installed packages.
解决:
参考:https://blog.csdn.net/HTML1033808020/article/details/124949278
根据报错信息,发现是因为该镜像源没有这个包或者composer版本过低而引起的报错,因此首先选择更换源:
composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
## 通过该命令,镜像源修改成功
## 有些镜像源在composer.json中已经设定了,此时需要修改composer.json文件
问题2:
更换源之后,继续执行composer命令,又出现了下述错误:
root@f6e5485502e2:/opt/drupal# composer require 'drupal/yunke_help:^2.4'
./composer.json has been updated
Running composer update drupal/yunke_help
Loading composer repositories with package information
https://packages.drupal.org/8 could not be fully loaded (curl error 28 while downloading https://packages.drupal.org/8/packages.json: Operation timed out after 10004 milliseconds with 0 out of 0 bytes received), package information was loaded from the local cache and may be out of date
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
47 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Endroid Installer did not detect a specific framework for auto-configuration
https://repo.packagist.org could not be fully loaded (curl error 28 while downloading https://repo.packagist.org/p2/asm89/stack-cors.json: Failed to connect to repo.packagist.org port 443: Connection timed out), package information was loaded from the local cache and may be out of date
Failed to audit installed packages.
分析上述报错,发现是连接超时(Connection timed out),猜测可能是docker hub不太稳定,多尝试几次之后就成功了。
docker等不太稳定的站点,可以用鹏哥的proxy方法。