I'm trying to use a continuous Integration with Gitlab CI.
I installed a fresh Laravel 8, add manually "laravel/nova": "~3.0", in composer.json
As stated in docs, I do
composer config http-basic.nova.laravel.com ${NOVA_USERNAME} ${NOVA_PASSWORD}
and then
➜ composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires laravel/nova, it 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.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I echoed ${NOVA_USERNAME} ${NOVA_PASSWORD} and I have doubled check that both field are OK. NOVA_USERNAME contains the registered email, and NOVA_PASSWORD contains the API Token found here: https://nova.laravel.com/settings/password
Anybody knows where am I failing ?
I believe it is because you didn't add the Nova repository to your composer.json file. It is mentioned in the documentation link you provided.
"repositories": [
{
"type": "composer",
"url": "https://nova.laravel.com"
}
],
Related
I've created a simple test wordpress plugin. The plugin consists of a single php file (kreplach.php) and a composer.json:
kreplach.php
<?php
/*
Plugin Name: kreplach
Plugin URI: http://gitlab.example.com/sales/kreplach
Description: just a test
Author: Foo Bartok
Version: 1.0
Author URI: http://example.com
*/
?>
composer.json
{
"license": "MIT",
"name": "sales/kreplach",
"type": "wordpress-plugin",
"description": "just a test",
"authors": [
{
"name": "Foo Bartok",
"email": "foo#example.com",
"homepage": "example.com"
}
],
"require": {
"composer/installers": "*"
}
}
On my dev server I have the following composer.json
Server's composer.json
{
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "vcs",
"url": "git#gitlab.example.com:sales/kreplach.git"
}
],
"require": {
"php": ">=5.4",
"wpackagist-plugin/akismet": "*",
"wpackagist-plugin/contact-form-7": "*",
"wpackagist-plugin/wordpress-importer": "*",
"sales/kreplach": "master",
"johnpbloch/wordpress": "4.*",
"composer/installers": "*"
},
"extra": {
"wordpress-install-dir": "wp"
}
}
What I think SHOULD happen:
Composer looks through the git repo for composer.json
Composer matches the name "sales/kreplach" found in the build host's composer.json
Composer copies the contents of the master branch into wp-content/plugins/kreplach on my build host.
My fake plug-in does nothing, as designed.
What actually happens:
Bitter, bitter failure.
Loading composer repositories with package information Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sales/kreplach 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.
I have tested cloning the sales/kreplach repo onto the same host I'm attempting to install the plugin on.
To make sure that composer is actually reading the composer.json file from the git repo, I introduced a typo (yeah, totally on purpose, like) which threw a "hey, this json file is broken, Foam Head" error.
My version of gitlab is omnibus edition 8.6.4 (installed today).
I have successfully done this same sort of trick with pip/requirements.txt to install custom python modules, so I'm not unused to following directions. Am I missing a step, or some sort of non-obvious (to me at least) nomenclature?
Update 2021, 5 years later, since GitLab 13.3 (Aug. 2020), GitLab (even in its free edition) has a Package Registry, establishing GitLab as a private repository.
You can publish in it Composer packages, and, with GitLab 13.11 (April 2021):
Use Composer v2 with the GitLab Package Registry
You use Composer to publish, share, and download your PHP dependencies to your GitLab Project. Six months ago, a new major version (v2) of Composer was launched with a variety of changes, including significant performance improvements, architectural updates, and runtime features.
You can read more about the changes here.
Until recently, you couldn’t take advantage of these improvements because the GitLab registry didn’t support Composer v2.
This prevented some of you from using the GitLab registry at all.
As an MVC, we focused on adding support for the mandatory parameter metadata-URL. We added a new endpoint GET group/:id/-/packages/composer/p2/:package_name, which returns the metadata for all packages in your repository.
When Composer looks for a package, it replaces %package% with the package name and fetches that URL.
This means we’ve added a new endpoint GET group/:id/-/packages/composer/p2/:package_name which will return the metadata for all packages in your repository.
Please note that there are two parameters considered optional.
We have issues open to add support for the providers-api and list-api parameters. We hope to prioritize them in an upcoming milestone.
See Documentation and Issue.
And (still GitLab 13.11, April 2021):
Download Composer dependencies from version control
You have two options when downloading Composer dependencies: source or dist. For stable versions, Composer uses dist by default and downloads the dependency as a zip file.
However, you can also download it directly from version control.
If --prefer-source is enabled, Composer downloads your dependency as a Git clone instead of as a packaged zip file.
This is useful if you want to make a bug fix for a project and get a local Git clone of the dependency directly.
Until recently, you could not use the prefer-source and related preferred-install commands and configurations when downloading Composer dependencies.
This prevented many of you from using the GitLab Package Registry for your Composer dependencies.
We are happy to announce that you can now download your Composer dependencies from source.
Do so by simply adding the prefer-source option to your install command like this: composer update --prefer-source.
See Documentation and Issue.
I've not used gitlab but have used this method quite a bit with Bitbucket and GitHub.
You need to specify "sales/kreplach": "dev-master" in the server's composer.json - note that the branch name must be prefixed with "dev-".
Apparently Composer has special support for GitHub and BitBucket, which may not exist for Gitlab...so you may need to specify git as the repository type rather than vcs.
Good luck!
Refs:
https://lornajane.net/posts/2014/use-a-github-branch-as-a-composer-dependency
https://getcomposer.org/doc/05-repositories.md#vcs
https://getcomposer.org/doc/05-repositories.md#git-alternatives
I have own package at github I created tag with name: "1.0.0".
composer.json in this tag don not have "minimum-stability" property (I tried with "minimum-stability": "dev" and "minimum-stability": "stable") but same error appears.
Error that I get is:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package am2studio/laravel-table-sorter 1.* could not be 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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I am trying to install package with
"comp-x/package-x": "1.*"
in composer and this error appears, with:
"comp-x/package-x": "dev-master"
everything is fine, and composer installs my package. Do you know what is problem here ?
I want to use: https://github.com/mikealmond/MusicBrainz
Copied the lib in myapp->vendor Folder. Installed Guzzle with composer and updated composer.
use GuzzleHttp\Client;
use MusicBrainz\Filters\ArtistFilter;
use MusicBrainz\Filters\RecordingFilter;
use MusicBrainz\HttpAdapters\GuzzleHttpAdapter;
use MusicBrainz\MusicBrainz;
require __DIR__ . '/vendor/autoload.php';
The autoload does not work. I tried many things and don't know, what to write in the composer.json.
Error: Class 'MusicBrainz\MusicBrainz' not found
When i call:
$brainz = new MusicBrainz(new GuzzleHttpAdapter(new Client()));
I tried in composer.json
"require-dev": {
"vendor/MusicBrainz": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mikealmond/MusicBrainz.git"
}
],
Then composer update...
And i get:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package src/musicbrainz 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.
Go to the linked repository page on Github. In the root folder, click on the file named composer.json. Search for a line with "name". The text right to it is the name of this package that you have to use in Composer.
Alternatively, go to https://packagist.org and type something close to the actual name into the search field, like musicb. Something will be found: https://packagist.org/search/?q=musicb
In any case, you will find the package name: mikealmond/musicbrainz.
Now go to the command line and type: composer require mikealmond/musicbrainz. Composer will do the rest, including the download of Guzzle because this is declared as a dependency.
After that step, the demo code will work - or at least will not fail because of missing classes.
I copied and pasted what was recommended I use from a thread on so.
Am I using a typo?
{
"require" : {
"facebook/php-sdk-v4" : "4.0.*",
"league/oauth2-client": "1.10"
}
}
Here's the full error message I get from composer:
/home/wiseman/public_html$ composer update Loading composer
repositories with package information Updating dependencies (including
require-dev) Your requirements could not be resolved to an installable
set of packages.
Problem 1
- The requested package league/oauth2-client 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion
for more details.
If Composer states that a package cannot be found, you have to go to packagist.org, type the package name into the big search field and see what you get.
In this particular case, the highest version released is 1.1.0, so you are missing one dot - or the source you copied it from.
EDIT: solved, I have to use "dev-master" instead of "master" or "dev".
maybe this seems weird to you... but I'm trying to locally install composer using a global composer binary.
I'm trying to write something like:
composer require composer/composer
But this doesn't work, it tells me that needs the version. Then I've tried the following variations:
composer require composer/composer=*
composer require composer/composer=master
composer require composer/composer=dev
And... nothing, I obtain the following error message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package composer/composer 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
Anyone has any idea if it's possible to do it in a "clean" way? (Allowing the following points):
specifying a very concrete version
registering it in the composer.json and composer.lock files
placing the composer binary with other php binaries like behat ...
Ok, I've made a stupid mistake. I have to use "dev-master", not "dev" nor "master".
Sorry for this dumb question.
Don't understand why do you want this, but I think #EDIT : Saw why you need this. Ok.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/composer/composer.git"
}
],
"require": {
"composer/composer": "dev-master#775f6cd5c633facf2e7b99611fdcaa900b58ddb7"
}
would work.
You can view here the commit hash corresponding to different releases : https://github.com/composer/composer/releases
Well, it seems to me that you are trying to install composer using composer itself. That of course is not possible.
To install composer you need to first download it from here.
Once you have done that you will be able to install packages using the 'require' command.