unable to install phpunit with composer - phpunit

basically i have this composer.json file:
{
"name": "phpunit/phpunit",
"require": {
"phpunit/phpunit": "3.8.*#dev"
},
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian#phpunit.de"
}
]
}
and when I go to run "composer install" i get the following error:
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/phpunit 3.8.*#dev -> satisfiable by phpunit/phpunit[3.8.x-dev].
- phpunit/phpunit 3.8.x-dev requires phpunit/php-code-coverage 1.3.*#dev -> 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.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I have no clue as to what that means? Thanks

Before actually answering your question:
You have called your project phpunit/phpunit and you have a require on phpunit/phpunit. That is a circular dependency. You should call your project something else.
Also, I doubt that you are "Sebastian Bergmann" so you should change the name of the author and email address in your composer file.
Ok, for you actual question, Composer by default won't install dev packages. You need to explicitly tell it to install dev packages by putting
"minimum-stability": "dev"
in your root composer.json file for your project, or change the require for PHPUnit to not use the dev package e.g.
"require": {
"phpunit/phpunit": "3.8.*"
},
Unless you are actively debugging an issue in another package, it's unlikely that you actually want to use a dev version of that package. You almost always want an actual tagged version.

Related

composer install -n --ignore-platform-reqs not ignoring PHP extension

we have circle build that runs composer install -n --ignore-platform-reqs --no-dev but this is not ignoring the platform requirements anymore.
This is what i see in the circle log. The --ignore-platform-reqs is clearly not working. Any ideas why please?
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for drupal/core 8.6.13 -> satisfiable by drupal/core[8.6.13].
- drupal/core 8.6.13 requires ext-pdo * -> the requested PHP extension pdo is missing from your system.
Problem 2
- typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- Installation request for typo3/phar-stream-wrapper v2.1.0 -> satisfiable by typo3/phar-stream-wrapper[v2.1.0].
Instead of using --ignore-platform-reqs or provide hack it is better to mimic your environment using platform setting - it gives you more control about platform requirements and it is more intuitive than provide (your package does not really provide ext-fileinfo):
"config": {
"platform": {
"php": "7.2.14",
"ext-fileinfo": "1.0.5",
"ext-pdo": "7.2.14",
"ext-session": "7.2.14",
"ext-iconv": "7.2.14",
"ext-zip": "1.15.4"
}
},
Actual versions of extensions you may find by calling this command on production environment (although you could probably put anything for extensions version - it is quite uncommon to use anything except * as a constraint for PHP extensions):
composer show -p
I am going to answer my own question just in case somebody stumbles here. Adding a provide with the list of extension in my composer.json file resolved the issue for me. This --ignore-platform-reqs had no effect.
"provide": {
"ext-fileinfo": "*",
"ext-pdo": "*",
"ext-session": "*",
"ext-iconv": "*",
"ext-zip": "*"
}

howto fix composer.json in forked symfony bundle

I'm trying to install symfony-cmf/routing-auto version 2.0.0-RC1 , it requires jms/metadata:1.5.* which is working under Symfony 2x.
My current project works on Symfony 3.3.x which makes this bundle unable to install, so I made a fork on github, changed req. to jms/metadata:1.6.*
and added one line:
"replace": "symfony-cmf/routing-auto:2.0.0-RC1",
in order to test if it will work and I used in console:
composer require mkoniarz/routing-auto:dev-master
but then I got error:
Reading composer.json of mkoniarz/routing-auto (dev-master) Skipped branch dev-master, Invalid argument supplied for foreach()
What else I should fix to get this fork installed by composer?
PS my composer is up to date.
Did you try to remove the composer.json file ? I'd an similar error, i think it can be resolve your problem.
Or you should to try :
composer require symfony-cmf/routing-auto
always check composer.json:
composer.phar validate
then commit if valid :)
error was in "replace" line:
"replace": "symfony-cmf/routing-auto:2.0.0-RC1",
should be:
"replace": { "symfony-cmf/routing-auto":"2.0.0-RC1" },

Cannot upgrade to Symfony 3 because of a dependency

I'm trying to upgrade from Symfony 2.8 to Symfony 3, but I cannot update it from Composer.
I get this error :
hellogerard/jobby dev-master requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0 ... blabla bla v2.8.2]
When I look the composer.json file of this library I need, I see this :
"require": {
(...)
"symfony/process": "^2.7"
},
You can find the composer file of Jobby here : https://github.com/jobbyphp/jobby/blob/master/composer.json
The problem is that in Symfony 3, the symfony/process version is 3.0, and because of the "^2.7" on Jobby's composer.json, I cannot get it. I know that there is no backwards compatibilities problems with symfony/process, so how can I do to fix / ignore that problem ?
Regards
Create your own fork and make a pull request on the base repository.
If there is no BC-break using the requested package with symfony/process:3.0,
just change the package version from ^2.7 to ^3.0 or >=2.7 in your fork's composer.json.
EDIT
Then, tell composer to use your fork for installations, like this :
"repositories": [
{
"type": "vcs",
"url": "https://github.com/yourusername/jobby"
}
],
"require": {
"hellogerard/jobby": "dev-master"
}
See VCS Repositories documentation

Meteor require unpublished npm module

In node, it's easy to do
"dependencies": {
"express": "^4.13.3",
"node-uuid": "^1.4.3",
"PACKAGE_NAME": "git://github.com/USERNAME/REPO_NAME.git#COMMIT_SHA"
}
In meteor I can include an npm module using var uuid = Meteor.npmRequire('node-uuid'); for npm packages that are published, but when pointing my package at github (the same way I would in a node project) I get an error.
How does one doe this with Meteor? When trying to do the same thing in the package.json I get the following error
"must declare exact version of dependency:"
Any help on how to include a package that's not published to Npm?
You need to specify the commit and point to the archive. From https://atmospherejs.com/meteorhacks/npm:
If you need to install an npm module from a specific commit, use the
syntax:
{ "googleapis": "https://github.com/bradvogel/google-api-nodejs-client/archive/d945dabf416d58177b0c14da64e0d6038f0cc47b.tar.gz" }

Installing EWZRecaptchaBundle in Symfony2

I'm using symfony 2.4.0, and I want to install the EWZRecaptchaBundle to add a captcha to my forms, so I added this line to composer.json
"require": {
//...
"excelwebzone/recaptcha-bundle": "2.0.*"
//...
}
And I run this command
composer update
But it doesn't install the bundle successfully, and this is the error message I get, in the command
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package excelwebzone/recaptcha-bundle 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 min
imum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
problems.
For the record, this is the Github link to the bundle I want to install :
https://github.com/excelwebzone/EWZRecaptchaBundle
Any idea??
Notes:
I use the command line as an Administrator.
I tested also with this line : ""excelwebzone/recaptcha-bundle": "dev-master"
The same result when I set minimum stability setting to : "dev" or "stable"
Try to use this require:
"excelwebzone/recaptcha-bundle": "dev-master"
Because 2.0.x-dev are in development now. or use old stable version:
"excelwebzone/recaptcha-bundle": "v1.0.0"
Victor you are completely right. However some might still encounter issues with the versioning.
You will still have an issue unless you use the exact 1.0 version.
So after doing the require:
composer require "excelwebzone/recaptcha-bundle"
you will have do add the version 1.0 like:
Please provide a version constraint for the excelwebzone/recaptcha-bundle requirement: 1.0.*

Resources