composer: package can not be found on each environment - composer-php

I was trying to install a composer package for Magento2 using composer require magestore/storelocator-magento2. In my local Vagrant box as well on my laptop the package could be found and was installed, whereas on a dev-server the same package could not be found.
My question is, which differences in the system setup or composer setup could be the reason, that an existing package cannot be found?
The composer.json and thus the stability settings are identical in all environments.
# machine 1
$ composer --version
Composer version 1.6.3 2018-01-31 16:28:17
$ composer require magestore/storelocator-magento2
Using version ^1.0 for magestore/storelocator-magento2
# machine 2
$ composer --version
Composer version 1.6.3 2018-01-31 16:28:17
$ composer require magestore/storelocator-magento2
[InvalidArgumentException]
Could not find a matching version of package magestore/storelocator-magento2.

Related

Composer install VS composer install --dev

Is there any differences between "composer install" and "composer install --dev"?
I ran these two commands and get the same packages installed.
As you can read in the documentation, leaving it out and using --dev performs the same action:
--dev: Install packages listed in require-dev (this is the default behavior).

composer install --dev is gone, how do I use dev dependencies?

Most people in my team doesn't need dev dependencies. So it is desirable that composer install doesn't install dev dependencies.
However, QA does need to install them with some command.
I have no idea how to achieve this now. Formerly it was composer install --dev but that's gone.
You can set the environment variable COMPOSER_NO_DEV to 0 or 1 to change the default behaviour of composer install and composer update.
see: documentation - COMPOSER_NO_DEV
If you want composer install to not install the dev dependencies by default
export COMPOSER_NO_DEV=1
If you want composer install to install dev dependencies (the default)
export COMPOSER_NO_DEV=0
or unset COMPOSER_NO_DEV
Depending on how you develop (i.e. in a container) there are various options to set a default value for the environment variable.
On the other hand you can instruct your engineer colleagues that do not require any dev dependencies to run the command:
composer install --no-dev
# .. or ..
COMPOSER_NO_DEV=1 composer install
... instead of ...
composer install
# .. or ..
COMPOSER_NO_DEV=0 composer install

Issue when installing composer on Ubuntu server

I Want to install laravel app and I user composer like this to install packages
composer install
And I get this error
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 doctrine/dbal 3.3.5 -> satisfiable by doctrine/dbal[3.3.5].
- doctrine/dbal 3.3.5 requires composer-runtime-api ^2 -> 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.
- 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 search any solution on the web without succes.
I'm on ubuntu server 20.04
Thank you
you have to upgrade the composer to version ^2.
run this command before "composer install"
=> composer self-update --2

Composer always fails to install symfony/var-dumper

I'm trying to install the latest version of Laravel 8 on the latest version of Homestead. When I run composer install or composer update, installation of symfony/var-dumper always fails:
Installing symfony/var-dumper (v5.2.6): Extracting archive
Install of symfony/var-dumper failed
[ErrorException]
file_get_contents(/home/vagrant/code/vendor/symfony/var-dumper/Resources/bin/var-dump-server):
Failed to open stream: No such file or directory
Despite the error exception, the file /vendor/symfony/var-dumper/Resources/bin/var-dump-server does exist.
Things I've tried:
Deleting the lock file and re-running composer update
Manually specifying specific versions of var-dumper, e.g. composer require symfony/var-dumper:5.2.0
I always get the same errors.
Remove /vendor folder, then run:
composer update -v
This turned out to be a compatibility issue with Composer 2.x. I downgraded to the 1.x channel using composer self-update --1, then ran composer install again, and the installation succeeded.
Composer version 2.2.4 2022-01-08 12:30:42
and
symfony/var-dumper v5.4.3
is working just fine

Drush doesn't update on one of two servers

I have 2 different Windows 2016 Servers running Drupal 8 and Drush 9 is installed on both but I have a Drush verison mismatch that I'm trying to fix.
I have this global composer.json file on both servers:
{
"require": {
"drush/drush": "9.*"
}
}
On my Test server, drush --version shows version 9.5.2.
On my Live server, drush --version shows version 9.7.0.
If I run composer global update drush/drush on my Test server, it doesn't update Drush and returns, "nothing to install or update".
I tried this:
composer global require drush/drush:9.7.0
and got this error:
Changed current directory to C:/Users/username/AppData/Roaming/Composer
./composer.json has been updated
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
- Can only install one of: consolidation/site-alias[3.0.0, 1.1.11].
- Can only install one of: consolidation/site-alias[3.0.0, 1.1.11].
- Can only install one of: consolidation/site-alias[3.0.0, 1.1.11].
- drush/drush 9.7.0 requires consolidation/site-alias ^3.0.0#stable -> satisfiable by consolidation/site-alias[3.0.0].
- Installation request for drush/drush 9.7.0 -> satisfiable by drush/drush[9.7.0].
- Installation request for consolidation/site-alias (locked at 1.1.11) -> satisfiable by consolidation/site-alias[1.1.11].
Installation failed, reverting ./composer.json to its original content.
Comparing the line, "name": "consolidation/site-alias", in composer.lock in both environments, I see that Test has 1.1.11 and Live has 3.0.0.
I installed drupal/recommended-project and thought I followed the same steps on both so I'm not sure how they got out of sync. Any ideas?
What is the recommended fix?
I ran composer require drush/drush and now both are on version 10.2.x.

Resources