jrgilman jrgilman - 4 months ago 10
Git Question

Composer not finding privately hosted package

So, composer search works and does return the package with its description. Additionally, it prompts me for authentication to get that information. The problem is when I run composer info tradedefender/xignite-options-reader it gives me a Package not found error. Same problem with attempting to install the package. Here is my application's composer.json:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "vcs",
"url": "https://jrgilman@bitbucket.org/tradedefender/xignite-options-reader.git"
}
],
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*"
},
"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": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}


Here is my package's composer.json:

{
"name": "tradedefender/xignite-options-reader",
"version": "master",
"description": "Reads options data from Xignite using PHP/Python",
"license": "proprietary",
"authors": [
{
"name": "Jacob Ray Gilman",
"email": "jacob.r.gilman@gmail.com"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"psr-4": {
"TradeDefender\\XigniteOptionsReader\\": "/src/php"
}
}
}


Here is the issue from the CLI:

jacob@jacob-MS-7693:~/Documents/test-env$ composer search tradedefender
Authentication required (bitbucket.org):
Username: XXXXXXXX@XXXXXXXX
Password:
Do you want to store credentials for bitbucket.org in /home/jacob/.composer/auth.json ? [Yn] n
tradedefender/xignite-options-reader Reads options data from Xignite using PHP/Python
jacob@jacob-MS-7693:~/Documents/test-env$ composer info tradedefender/xignite-options-reader


[InvalidArgumentException]
Package tradedefender/xignite-options-reader not found

Answer

My version of Composer includes the following output from composer info --help:

-i, --installed
    List installed packages only (enabled by default, only present for BC).

It looks like composer info just looks at installed packages by default. Adding either the --all flag (to show installed and available packages) or -a / --available flag (to show just available packages) should make this work:

composer info --all tradedefender/xignite-options-reader

It has nothing to do with the repository being private.

Comments