Composer settings ignore version matching

Source: Internet
Author: User
Tags composer install
The Composer settings ignore version matching execution composer install encountered an error: Your requirements cocould not be resolved to an installable set of packages. this is because it does not match the version required by composer. json.

The complete error is as follows:

vagrant@homestead:/usr/share/nginx/html/laravel-blog$ sudocomposerinstallLoadingcomposerrepositorieswithpackage informationInstallingdependencies (includingrequire-dev) fromlockfileYourrequirementscouldnot beresolvedto aninstallablesetofpackages.   Problem 1    - Installationrequestfor doctrine/instantiator 1.0.3 -> satisfiablebydoctrine/instantiator[1.0.3].    - doctrine/instantiator 1.0.3 requiresphp ~5.3 -> yourPHPversion (7.0.3) doesnot satisfythatrequirement.  Problem 2    - doctrine/instantiator 1.0.3 requiresphp ~5.3 -> yourPHPversion (7.0.3) doesnot satisfythatrequirement.    - phpunit/phpunit-mock-objects 2.3.0 requiresdoctrine/instantiator ~1.0,>=1.0.1 -> satisfiablebydoctrine/instantiator[1.0.3].    - Installationrequestfor phpunit/phpunit-mock-objects 2.3.0 -> satisfiablebyphpunit/phpunit-mock-objects[2.3.0].

The prompt is that my PHP 7 version is too high and does not conform to the version required by composer. json. However, it can also be run in PHP 7. the composer can set to ignore version Matching. the command is:

composerinstall --ignore-platform-reqs

Or

composerupdate --ignore-platform-reqs

Run the composer command again to run the installation package normally.

If a warning is prompted:

Cannotcreatecachedirectory /home/vagrant/.composer/cache/repo/https---packagist.org/, or directoryis not writable. ProceedingwithoutcacheCannotcreatecachedirectory /home/vagrant/.composer/cache/files/, or directoryis not writable. Proceedingwithoutcache

This is to execute composer in the virtual machine, prompting that this directory does not have the write permission, composer cannot cache the downloaded package, so that each time you have to download again, change the directory to writable and readable.

sudochmod -R 777 /home/vagrant/.composer/cache/files/

In addition, set composer as a domestic image in the virtual machine. Otherwise, the download speed will be slow. execute:

composerconfig -g repo.packagistcomposerhttps://packagist.phpcomposer.com

OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.