Error installing composer due to symfony/routing version - php

In Ubuntu 18.04, I have php installed. I confirmed it work with index.php testing. I now try to install composer
composer install
But below error was shown:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/routing v4.1.6 -> satisfiable by symfony/routing[v4.1.6].
- don't install symfony/symfony v3.4.17|don't install symfony/routing v4.1.6
- Installation request for symfony/symfony v3.4.17 -> satisfiable by symfony/symfony[v3.4.17].
I have previously install Symfony as a package by
sudo apt install php-symfony
php-symfony is already the newest version (3.4.6+dfsg-1ubuntu0.1).
Do I uninstall symfony and replace it with symfony/routing v4.1.6?
I googled for a long time but I cannot find relevant instructions. Symfony documentation appears to only show instruction on using composer to install Symfony. But I now have trouble to install composer. Please help, thanks!

The symfony/symfony package already includes the Routing component (which you try to install with the symfony/routing package). This is something Composer wrongly allowed in older versions and was fixed in Composer 1.7.3.
Do you really need the Routing component in version 4? If that's the case, you need to remove symfony/symfony first and require all the needed components explicitly if you cannot upgrade all Symfony packages to 4.1.

If you want to install a new Symfony project, I recommend not using the packaged php-symfony and instead use composer to create a new project from scratch. I don't know much about the package, but as you can tell from the version it is outdated (v3.4.18 is the current version). Relying on an outdated package is not recommended. Instead use the recommended way to set up a new project:
composer create-project symfony/skeleton my-project
If you want a full stack application you can also use symfony/website-skeleton as the basis for the project. If you want to stick to the old 3.4 version you can add the constraint to the command:
composer create-project symfony/skeleton:"^3.4"
See also https://symfony.com/doc/current/setup.html

Related

I can't update package I forked anymore, was working a week ago

I forked a php package and am using forked version in my local machine, I plan to extend the package, while I was working with it a week ago everything was working fine, today when I focused on this part of the application again and had to update the package with latest code I had pushed to repo, so I tried to update the package like
composer update author/package-name
and I also have this part in the composer.json
"repositories": [
{
"type": "vcs",
"url": "https://github.com/myproject/package-name"
}
],
I suddenly get this:
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
symfony/event-dispatcher v4.0.3 requires php ^7.1.3 -> your PHP version
(7.1.1) does not satisfy that requirement.
symfony/event-dispatcher v4.0.3 requires php ^7.1.3 -> your PHP version (7.1.1) does not satisfy that requirement.
Installation request for symfony/event-dispatcher (locked at v4.0.3) -> satisfiable by symfony/event-dispatcher[v4.0.3].
I currently have php 7.1.1 installed and am running laravel 5.4, I wonder why after a week or so where I was able to run the command above without a problem today I can't and what is also confusing me is this:
https://laravel.com/docs/5.4/installation
php requirement for laravel on the server is 5.6.4 or higher.
So why would symfony/event-dispatcher require 7.1.3 and why would laravel's own page claim version 5.4 min-requirment is php 5.6.4?
Anyone has any clues?
The 3.4 and the 4.0 branch of the symfony/event-dispatcher package have different PHP requirements. It looks like a package inside your dependency tree has caused an update from symfony/event-dispatcher 3.4 to 4.0.
To find out why this package was installed, you can use Composer:
composer why symfony/event-dispatcher
You could also grep for symfony/event-dispatcher in the composer.json files in your vendor directory:
grep -r --include=composer.json symfony/event-dispatcher vendor/
You will most likely see that some of them work with both branches of that package, e.g.
…
"symfony/event-dispatcher": "~3.4|~4.0",
…
(Note that some of the entries, for example those with a <3.4 value, are not from the require, but from the conflict section.)
You can try forcing your project to use a 3.x version of the symfony/event-dispatcher package. Add the following to your root composer.json:
"symfony/event-dispatcher": "<4.0"
This should force the installation of the 3.4 branch. But you might run into a dependency conflict if there’s a package requiring the 4.0 branch.

Can't Create a new laravel app

Am trying to create a new laravel project, in the past i have successfully created a new laravel project by running laravel new blog, i just tried it about 2hrs ago and i get this error.
nkossy Desktop $ laravel new blog
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/thanks v1.0.1 -> satisfiable by symfony/thanks[v1.0.1].
- symfony/thanks v1.0.1 requires composer-plugin-api ^1.1 -> 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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Application ready! Build something amazing.
am running Ubuntu 16.04 with php7.1 installation
Running composer update doesn't help
Remove "symphony/thanks" dependency in your project's composer.json plugin and run 'composer update' after.
Here is what I did.
First, uninstall composer, Follow instructions here
then reinstall composer by running the following command.
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Lastly run laravel new app, done.

How to work around ubuntu php version for composer update

I'm trying to update my symfony project using composer. I'm running into a strange issue I'm not really sure how to handle. My php version is high enough to update but its formatted in such a way composer wont let me update. Here's my error message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/symfony v3.0.1 requires php >=5.5.9 -> your PHP version (5.6.11-1ubuntu3.1) does not satisfy that requirement.
- symfony/symfony v3.0.0 requires php >=5.5.9 -> your PHP version (5.6.11-1ubuntu3.1) does not satisfy that requirement.
- Installation request for symfony/symfony 3.0.* -> satisfiable by symfony/symfony[v3.0.0, v3.0.1].
As you can see, my php version is indeed high enough to update, however, composer says no. How to I force it to update anyway?
How to I force it to update anyway?
With the --ignore-platform-reqs option composer ignore all the php, ext-*, lib-* requirements and force the installation even if the local machine does not fulfill these.
composer install --ignore-platform-reqs
composer update --ignore-platform-reqs
The option is available also for create-project, remove and require.
The documentation can be read here.

Installing a single dev package with Composer

I have minimum-stability: stable in my composer.json, but I need to install the dev version of one of the packages.
How can I force Composer to install the dev version only of that package?
Just to be clear. I want to install Yii2 2.0.x-dev (instead of 2.0.4, which is the latest stable version).
You can enforce specific stability with #
2.0.x-dev#dev
You can find some example in the Composer documentation

Symfony2 and composer not installing packages

I'm trying to install the FOSUserBundle on Symfony2.
On trying to run this command in the Terminal
composer update friendsofsymfony/user-bundle
I am presented with this error:
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
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from
your system, make sure to have the extension providing it.
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from
your system, make sure to have the extension providing it.
- Installation request for symfony/icu == 1.2.0.0 -> satisfiable by symfony/icu[v1.2.0].
I have read about the INTL extension not being installed correct, so I followed these instructions, restarted MAMP and the issue is still present!
I've checked with phpinfo() also and it's confirmed that INTL has been installed. I'm at a loss on how to get rid of these errors!
The issue is still present because you are running composer update only for FOSUserBundle.
First try to run composer update symfony/icu, and then run composer update friendsofsymfony/user-bundle.
If this doesn't work, try updating all your vendors with composer update

Categories