composer: Can't get "path" repository to work - possible bug?
This is inside a Laravel project.
With the following composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"repositories": [
{
"packagist": false
},
{
"type": "path",
"url": "./packages/*/*"
}
],
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"stripe/stripe-php": "^3.9",
"geoip2/geoip2": "~2.0",
"balunker/testpackage": "*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
[
"database"
]
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
When I run this command:
composer update -vvv
I get this output:
vagrant@scotchbox:/var/www/api.aftercare$ composer update -vvv
Reading ./composer.json
Loading config file /home/vagrant/.composer/config.json
Loading config file /home/vagrant/.composer/auth.json
Loading config file ./composer.json
Checking CA file /etc/ssl/certs/ca-certificates.crt
Executing command (/var/www/api.aftercare): git branch --no-color --no-abbrev -v
Reading /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/config.json
Loading config file /home/vagrant/.composer/auth.json
Loading config file /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/auth.json
Reading /var/www/api.aftercare/vendor/composer/installed.json
Reading /home/vagrant/.composer/vendor/composer/installed.json
> pre-update-cmd: php artisan clear-compiled
Executing command (CWD): php artisan clear-compiled
Loading composer repositories with package information
Executing command (/var/www/api.aftercare/packages/balunker/testpackage/): git branch --no-color --no-abbrev -v
Updating dependencies (including require-dev)
Resolving dependencies through SAT
Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package balunker/testpackage could not be found in any version, there may be a typo in the package name.
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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
And I expected this to happen:
The balunker/testpackage
should be installed from the path
repository. I got this to work yesterday, but then I created a new package and it doesn’t work anymore. I tried all kinds of things (and disabled packagist to speed up the debug process).
My directory folder is standard Laravel, but basically:
composer.json
packages/
balunker/
testpackage/
composer.json
The composer.json of the package looks like this:
{
"name": "balunker/testpackage",
"autoload": {},
"require": {
"php": ">=5.5.9",
"firebase/php-jwt": "^3.0"
}
}
As simple as somehow possible, but no success. This all runs inside Vagrant on a OS X host.
Any ideas would be greatly appreciated!
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (7 by maintainers)
*@dev
should also work.You need to require that package with
dev-master
, not*
. The former explicitly allows a dev version (overriding whatever valueminimum-stability
has), the latter does not (since by defaultminimum-stability
is set tostable
).That should be
../packages/*/*
from your folder structure.I think the thing biting you here is that the Version Guesser kicks in, sees your Git clone, and (correctly) marks the package an unstable dev release. You could also have fixed this with the following in your
composer.json
:That’s what I use myself to develop a nested set of packages.
But if you have suggestions to improve the documentation by all means issue a PR 👍
Hi @alcohol,
I’m currently developing a package that I want to later
require
with composer. So I have the following folder structure, similar to the one in your documentation:The
composer.json
inapps
looks like this:The
composer.json
inapps/packages/test-vendor/test-package
looks like this:If I am in
apps
and do ancomposer update
, I get the message that:I had to change the
*
to adev-master
to get this to work. The docs however say that*
should work, without mentioning that this will not work if you do not have a stable release. Again, sounds like it’s absolute common sense to developers working with composer all the time, but for somebody that doesn’t, this was an very frustrating experience.The very statement (“The requested package … could not be found in any version”) was misleading to me personally, as I thought this means that composer cannot even find the package.
Nevertheless, everything works now and I greatly appreciate your contribution! 👍
You should add
"minimum-stability": "dev"
and"prefer-stable": true
into your root composer.json. so your composer will be like this:Alright, closing this then. But feel free to continue the discussion if desired 😃