【问题标题】:Composer ignoring my local repo package and it tries to download it from remote VCS repoComposer 忽略我的本地 repo 包并尝试从远程 VCS repo 下载它
【发布时间】:2021-05-16 06:17:26
【问题描述】:

我正在尝试使用 vendor-legacy 文件夹中的一个包。

这是这个文件夹的结构:

vendor-legacy
└── directus
    ├── oauth2-okta
    ├── proxy-detection
    ├── rate-limit
    └── zend-db

在我的composer.json 文件中,我将其声明为:

"repositories": [
    {
      "type": "path",
      "url": "vendor-legacy/directus/oauth2-okta"
    },
    {
      "type": "path",
      "url": "vendor-legacy/directus/proxy-detection",
      "options": {
        "versions": {
          "directus/proxy-detection": "0.5.1"
        }
      }
    },
    {
      "type": "path",
      "url": "vendor-legacy/directus/rate-limit"
    }
  ],
  "require": {
    "directus/oauth2-okta": "dev-master",
    "directus/proxy-detection": "*",
    "directus/rate-limit": "dev-master",
  },

这是我在composer update --ignore-platform-reqs 之后得到的结果

Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing directus/proxy-detection (0.5.1): Downloading (failed)    Failed to download directus/proxy-detection from dist: The "https://api.github.com/repos/directus/proxy-detection/zipball/e1fd098352dec991bb857e216a099a0758615328" file could not be downloaded (HTTP/1.1 404 Not Found)
    Now trying to download from source
  - Installing directus/proxy-detection (0.5.1): Cloning e1fd098352

                                                                                                                                                                                                                                       
  [RuntimeException]                                                                                                                                                                                                                   
  Failed to execute git clone --no-checkout 'https://***:***@github.com/directus/proxy-detection.git.git' '/Users/owls/unsound-website/unsound-directus/vendor/directus/proxy-detection' && cd '/Users/owls/unsound-website/unsound-d  
  irectus/vendor/directus/proxy-detection' && git remote add composer 'https://***:***@github.com/directus/proxy-detection.git.git' && git fetch composer && git remote set-url origin 'https://github.com/directus/proxy-detection.g  
  it.git' && git remote set-url composer 'https://github.com/directus/proxy-detection.git.git'                                                                                                                                         
                                                                                                                                                                                                                                       
  Cloning into '/Users/owls/unsound-website/unsound-directus/vendor/directus/proxy-detection'...                                                                                                                                       
  remote: Repository not found.                                                                                                                                                                                                        
  fatal: repository 'https://github.com/directus/proxy-detection.git.git/' not found                                                                                                                                                   
                                                                                                                                                                                                                                       

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

包 oauth2-okta 和 rate-limit 已正确安装并符号链接到我的 vendor 文件夹。只有这个代理检测似乎有一个我不明白的问题。如果有人遇到这个问题,我很乐意提供帮助。

【问题讨论】:

标签: php git composer-php directus


【解决方案1】:

我不确定主要问题是什么,但我通过添加解决了它:

    "extra": {
        "branch-alias": {
            "dev-master": "0.5.1"
        }
    },

到代理检测包内的composer.json,

然后在根composer.json 中,我所要做的就是将依赖版本声明为dev-master

我不知道为什么将版本设置为0.5.1 会直接导致问题。

希望这个解决方案将来能对某人有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    • 2016-10-01
    • 2021-07-03
    • 2018-04-25
    • 2014-10-09
    • 2013-11-18
    • 2011-01-18
    相关资源
    最近更新 更多