John Davidson

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

0 comments
Message:


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.



My Answer:
It looks like Composer is still trying to download the `directus/proxy-detection` package from the remote VCS repository instead of using the local repository that you have specified in your `composer.json` file.

One thing you can try is to remove the `vendor` folder and then run `composer install` again. This will force Composer to re-install all the dependencies, including the local repository packages.

If that doesn't work, you can try explicitly specifying the path to the local repository in the `composer.json` file. For example:

json
"repositories": [
{
"type": "path",
"url": "vendor-legacy/directus/proxy-detection"
}
],
"require": {
"directus/proxy-detection": "*"
}


Make sure to run `composer update` or `composer install` after making these changes.

If the issue persists, you may want to check if there are any typos in the path or if the local repository is set up correctly.

Additionally, you can try clearing Composer's cache by running `composer clear-cache` and then running `composer update` again.

If none of these solutions work, you may need to further investigate the issue or consider reaching out to Composer support for assistance.

Rate this post

4 of 5 based on 2745 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us