How to fix composer problems while trying to configure magento2 - magento

I am trying to install/configure magento2. I cloned it from GitHub with:
cd /var/www/html
git clone https://github.com/magento/magento2.git
After that I am trying to install Composer:
cd /var/www/html/magento2/
composer install -v
And I am getting this warning.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
I tried to install phpunit but it not helped. Any idea?

There is not much what you can do. You get this warning because Magento uses PHPUnit 6 as dev dependency. PHP 6 EOLed in February (see supported versions summary) and uses deprecated package phpunit/phpunit-mock-objects as one of its dependencies. The right way to fix this is to upgrade PHPUnit to 7.x or 8.x line, but this rather a job for Magento devs.
As a end user who just want to use Magento, you can safely ignore this warning - it is only a warning to bring your attention on fact, that you're using unmaintained package. This is not a big issues, since this is only a dev dependency, and you're probably not a Magento developer. You will not get this warning if you use --no-dev switch (which you should use for production installation anyway):
composer install --no-dev

Related

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5"

I'm trying to upload a plain laravel v5.8 project to a server. It gives me this error
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5".
I updated the Laravel version to v6 and it still throws the same thing.
Is there any possible solution I tried many but nothing happens. Thanks in advance.
I faced this problem using the new version of composer, didn't have seen this issue before, although this question is a bit old the solution can help someone else.
I did this working in a development machine, if you really need to change the PHP version running in your server this isn't for you.
This problem is related to a composer configuration when you run the command "composer install" if you need to work with the configuration you already have and don't want to make changes which could lead to other problems you should:
remove the packages you already have installed which includes this configuration from composer
sudo rm -r vendor
run the command again with this flag: --ignore-platform-reqs
composer install --ignore-platform-reqs
Now composer won't perform this check anymore and you are good to go!

Installing Prestashop developer version

I wonder if anyone has experiencing installing Prestashop 1.7 dev version on Windows 10? I cloned the developer vbersion of Prestashop from the official git repo and initiated the install. The install asks me to run the command "php composer.phar install" so I did and get the following error when I do:
Problem 1
- composer/installers is locked to version v1.7.0 and an update of this package was not requested.
- composer/installers v1.7.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match your constraint.
Use the option --with-all-dependencies to allow updates and removals for packages currently locked to specific versions.
You are using a snapshot build of Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report an issue to them to ask them to support Composer 2. To work around this you can run Composer with --ignore-platform-reqs, but this will also ignore your PHP version and may result in bigger problems down the line.
I am running the latest version of composer on Windows 10 and am at a complete loss on how to proceed any further therefore any help would be appreciated.
According to the Prestashop team their development build is not yet compatible with Composer 1.10.5 hence the errors I encountered.
Thanks.

Laravel Installer method

Normally I do install Laravel 5.1 by following this command regarding to documentation:
composer create-project laravel/laravel --prefer-dist
It works fine.
But I read in the documentation under "Via Laravel Installer" also it is possible to install via Laravel Installer, which is much faster than installing via Composer:
laravel new blog
But to use this method I need to run following command once:
composer global require "laravel/installer=~1.1"
When I do run it I get following errors many times
Deprecation Notice: Composer\Package\Version\VersionParser::parseLinks
is deprecated. Use \Composer\Package\Loader\ArrayLoader::parseLinks()
instead in
phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:226
after many line of same error ./composer.json has been updated appears and it continues with the same line of errors, it ends with following
Loading composer repositories with package information Updating
dependencies (including require-dev) Nothing to install or update
Generating autoload files
What is wrong with it? Any idea or solution.
My environment: Windows 10, GitBash and cmder console.
Update of composer, I did ran composer self-update also
Snapshot of console
EDIT:
Note, I can confirm after solving the issue that the installation via Laravel Installer method is faster than composer.
The Composer Assets Plugin you've installed locally is using a deprecated method of Composer. The plugin is already fixed, so run composer global update to get the latest versions with the bug fix. After it, you should be able to run the command succesfully.
If this doesn't work (as you might get the same error running the previous command), try removing the global vendor directory. When running any global Composer command, it outputs something like "Changed current directory to XXX". Remove the XXX/vendor directory and then try running the command.
In addition to #WouterJ answer.
Worst case if the steps provided by #WouterJ did not work, you could manage to uninstall and reinstall composer for windows.
When done, run composer global update to be sure to get latest updates, if there was.
Then run composer global require "laravel/installer=~1.1" and it should works.
Remember to update your windows environment path C:\Users\UserName\AppData\Roaming\Composer\vendor\bin

Manually install Parse PHP SDK without Composer

I've got a client on a shared hosting environment (which I can't change) and I'm needing to install the Parse PHP SDK, but the host won't allow me to install the Composer package manager. Does anyone else know of a manual install method?
If you have wget/unzip available, just download latest release zip (bellow the release, this file).
Use unzip to unpack package and load it with PSR-4 autoloading (the composer's approach).
Composer isn't meant to be an installer, so you are not expected to run Composer on the production machine. What would happen if during your update process Github would be down? No new website version! And maybe also no old version.
Run Composer somewhere else, and then upload the result to the server, after you verified that everything went well.

Travis CI build fails for PHP 5.4 while trying to run composer

I am creating an open source project written in PHP and I'm starting to use Travis CI for testing on PHP versions 5.4, 5.5, 5.6 and HHVM.
The tests for 5.5, 5.6 and HHVM pass without any issues, but I get an error on PHP 5.4.
The error is listed here: https://travis-ci.org/CodeRichard/simple-config/jobs/58154496
I noticed it had something to do with the PHPUnit package which I use for local development and pulled in using Composer. This version requires symfony/yaml ~2.1|~3.0. After a bit of googling, I found out the pipe symbol is used as an OR symbol. This bit confuses me a little.
When I read ~2.1|~3.0 I assume it'll try to pull in one and if it fails, the other. I know symfony/yaml 3.* requires PHP 5.5.9, whereas 2.* requires 5.3.9.
What I don't understand is why it fails. Isn't it supposed to pull in symfony/yaml 2.* instead?
Right now, I'm requiring PHPUnit 4.6.* for development. The requirement for PHPUnit is PHP 5.3.3. However, Composer fails when trying Travis CI is trying to test for PHP 5.4. This makes absolutely no sense. If it would crash on PHP 5.4 and PHPUnit 4.6 requires symfony/yaml 3.0, shouldn't the requirement be 5.5?
I know I can just downgrade PHPUnit to 4.5, but I wish to remain up to date, so I'd rather not.
That error message is simple: Composer cannot install a component that got recorded in the composer.lock file, but doesn't match the requirements of THIS PHP:
symfony/yaml 3.0.x-dev requires php >=5.5.9
This will not work with PHP 5.4.
Downgrading your development machine to 5.4 and run composer update again will fix it.
Running composer update instead of composer install in Travis CI will also fix it. If you decide to do this, you should also run Travis with composer update --prefer-lowest to test that your declared minimum versions are correctly working.
You should also try to avoid "minimum-stability":"dev", unless you are really sure that you need bleeding-edge packages. Currently you are using no other packages, so it's not necessary to deal with the issues of unstable dev versions.
Remove composer.lock
This is what I have in my .travis.yml
# ...
before_script:
- rm composer.lock
- composer install --no-interaction --prefer-source
# ...
Issue: #2823

Resources