You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Composer安装GitHub包?解决命名格式报错问题

Composer安装GitHub包时的命名格式错误

以下配置可成功安装GitHub仓库中的包,执行composer install无异常:

{
  "config": {
    "allow-plugins": {
      "composer/installers": true
    }
  },
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/tombenner/wp-mvc.git"
    }
  ],
  "require": {
    "tombenner/wp-mvc": "dev-master"
  }
}

但使用如下composer.json配置安装另一GitHub包时:

{
  "config": {
    "allow-plugins": {
      "composer/installers": true
    }
  },
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/sampoyigi/ti-ext-localepicker.git"
    }
  ],
  "require": {
    "sampoyigi/ti-ext-localepicker": "dev-master"
  }
}

执行composer install会出现命名格式错误,错误信息翻译为中文如下:

在RootPackageLoader.php第160行:

require.ti-ext-localepicker 无效,它应当包含厂商名称、斜杠和包名。厂商名和包名可以是用-、.或_分隔的单词。完整名称需匹配正则表达式 "^a-z0-9/a-z0-9$"。

内容的提问来源于stack exchange,提问作者user294265

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 20:59:52