Requested package ... not found in any version

When I want to request my project, the following errors will appear:

The requested mvc-php / framework package was not found in any version; there may be a typo in the package name.

"mvc-php / framework" is the git folder.

{ "name": "mvc-php/app", "repositories": [ { "type": "path", "url": "/Users/youri/Documents/Github/framework" } ], "require": { "php": ">=7.0", "mvc-php/framework": "master" }, "autoload": { "psr-4": { "App\\": "app/" } } } 

The project I want to request is:

 { "name": "mvc-php/framework", "description": "PHP MVC framework", "autoload": { "psr-4": { "Mvc\\" : "src/" } }, "require": { "php": ">=7.0" } } 
+5
source share
3 answers

branchName@dev required instead of branch name

https://getcomposer.org/doc/articles/versions.md#branches

 { "name": "mvc-php/app", "repositories": [ { "type": "path", "url": "/Users/youri/Documents/Github/framework" } ], "require": { "php": ">=7.0", "mvc-php/framework": " master@dev " }, "autoload": { "psr-4": { "App\\": "app/" } } } 
+7
source

Since this is the first answer when searching for error text on Google, I would also put my correction here, even though it was not 100% relevant to OP.

When you need a repo, you need to make sure that your request requires a match with the project name in the project composer.json project.

So, if the name was "name": "mvc-php/app-framework", in the framework project, then the requirement should be:

 "require": { "mvc-php/app-framework": "dev-master" }, 

This is more applicable if you add the git repository. Especially when forked, because sometimes the git URL may be different from the name composer.json.

Additionally (and this is the OP part), now you need to execute dev-branch_name instead of branch_name@dev . I do not know when this has changed, or if the old method is unsuitable. But this is what the current composer is saying now.

If you want Composer to check the branch instead of the tag, you need to point it to the branch using the special dev-* prefix dev-* Composer Documentation - Versions and Limitations - Branches

+3
source

The requested X / Y package cannot be found in any version.

The requested package should be a git folder with an attached and existing composer.json file. Then, to refer to a specific branch, you need to add the dev- prefix, so dev-master is not master .

Example

Here is a minimal working example:

File: composer.json

 { "require": { "local/my_package": "dev-master" }, "repositories": [ { "packagist.org": false }, { "type": "path", "url": "my_package/" } ] } 

File: my_package/composer.json

 { "name": "local/my_package", "require-dev": { "symfony/console": "*" } } 

Note. Above the file is the local git repository. To create one, run: git init && git commit -am 'Files' .

Troubleshooting

To fix the problem, do:

 composer install -vvv 

Also consider running: composer diagnose to identify common Composer errors.

0
source

Source: https://habr.com/ru/post/1258431/


All Articles