PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 31, 2022

[FIXED] Composer dependency issue with external repository

 January 31, 2022     composer-php, dependency-management, php     No comments   

Issue

I have written a library that I want to use in another project. However, when I add the library dependency to my project I get the following error after running composer update -vvv:

Your requirements could not be resolved to an installable set of packages.

Problem 1
    - Installation request for my/library dev-master -> satisfiable by my/library[dev-master].
    - my/library dev-master requires doctrine/migrations dev-master -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

This error is very confusing to me since my project has my library as it's only dependency, i.e. my project composer.json looks like this:

{
    "name": "my/project",
    "type": "project",
    "description": "My project",
    "autoload": {
        "psr-0": { "MyNamespace\\": ["src/", "tests/src/"] }
    },
    "repositories": [ {
       "type": "vcs",
       "url": "git@bitbucket.org:my/library"
     } ], 
    "require": {
        "php": ">=5.5",
        "my/library": "dev-master"
    },
    "require-dev": {
        "phpunit/phpunit": "3.*"
    }
}

As you can see, pretty straight forward. The reason the version of my library is requiring dev-master is because master is currently the only branch I work on (I work alone, no need for other branches at the moment).

So far the only way for the resolve this problem is by adding the dependencies of my library composer.json to my project's composer.json which seems like an unnecessary step.

How can I resolve this dependency issue?


Solution

It looks to me as if it is a stability issue. Add the following two lines to your composer.json:-

"minimum-stability": "dev",
"prefer-stable": true,

ref:- minimum-stability & prefer-stable

Hopefully that will sort out your problem.



Answered By - vascowhite
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing