Composer ignoring my local repo package and it tries to download it from remote VCS repo

Viewed 683

I am trying to use one of my packages from vendor-legacy folder.

Here is the structure of this folder:

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

In my composer.json file I declared it as:

"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",
  },

Here is what I am getting after 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>]...

Packages oauth2-okta and rate-limit are installed properly and symlinked to my vendor folder. Only this proxy-detection seems to have a problem which I don't understand. If anyone faced that problem I would be glad for help.

1 Answers

I am not sure what was the main problem, but I solved it by adding:

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

to composer.json inside proxy-detection package,

then in root composer.json all I had to do was declare dependency version as dev-master.

I have no idea why setting version as 0.5.1 directly caused problems.

Hope this solution will help someone in future.

Related