Reputation: 1451
I am using artifactory and have no issues with the npm solution. However, I have set up composer using the "Set Me Up" instructions, i.e. installed the ~/.composer/config.json
& ~/.composer/auth.json
files. I now get the following error when I try to perform a composer install:
$ dcomp install
Loading composer repositories with package information
[Composer\Downloader\TransportException]
The "https://myartifactory.jfrog.io/artifactory/api/composer/php-local/packages.json" file could not be downloaded (HTTP/1.1 404 Not Found)
install [--prefer-source] [--prefer-dist] ...
The user I have configured in auth.json
is an admin user, and I've pushed a single package into the Artifactory. Additionally, I noticed the url contains plural packages.json
as opposed to singular package.json
, so I am assuming this is an issue with the artifactory configuration itself and not the package I've uploaded.
Upvotes: 2
Views: 1640
Reputation: 2586
I have seen an Include / Exclude Pattern on the Jfrog repository that does not match the <vendor>/<package>
naming standard cause this issue. We were able to upload artifacts but they were excluded metadata endpoint.
The following endpoint returned a 404 response code for every package until the Include / Exclude Pattern was fixed.
https://<org>.jfrog.io/artifactory/api/composer/<repo>/p2/<vendor>/<package>.json
Upvotes: 0
Reputation: 1451
The issue in my case was as a couple commenters observed: the index wasn't being generated.
For me, the fix was a matter of using a .zip
compressed file to upload composer packages instead of a .tar.gz
. I can't tell you why a tarball won't work, especially considering Artifactory's documentation explicitly mentions tar.gz
, but it would appear .zip
is the way to go.
Upvotes: 1
Reputation: 20376
When you first create a PHP composer repository in Artifactory it will not have the repository index yet (package.json file). The index will be created only after you deploy your first package.
It is possible that Artifactory was unable to read the package metadata for the package you deployed. In such a case, assuming this is the only package in the repository, the index will not be calculated.
In order to verify this is the case:
php-local
repository in the Artifactory UI.composer/packages.json
file (relative to the repository root). If it does not exist, it is an indication that Artifactory was unable to calculate the repository indexcomposer.json
file)Failed to persist package metadata for 'php-local/my-package.zip'. Unable to read the package version from the extracted composer.json file
If this is the case, you can solve the issue by:
composer.version
to your composer package and set its value to be the correct package version. You can do it by selecting the package file from the UI, switching to the Properties tab and adding a new propertypackages.json
file is being generatedIf all of this does not help and the packages.json file is still not generated, there is probably another error which prevents Artifactory from generating it.
Try re-generating the repository index by:
Finally, one more option to try is deploying a different composer package and seeing if it behaves the same.
Upvotes: 0
Reputation: 307
For Artifactory to index composer packages successfully you also need to make sure that each package has version specified.
There are 3 ways to achieve that:
You can easily test it inside the UI by clicking on the archive you just uploaded, then go to the properties tab and add a property for example:
composer.version with value for example 1.0.0.
Upvotes: 1