laravel new blog not work mockery/mockery 1.4.0

Viewed 19851

Today I wanted to create a new project with Laravel with this command

laravel new blog

But I get this error

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 mockery/mockery 1.4.0 -> satisfiable by mockery/mockery[1.4.0].
    - mockery/mockery 1.4.0 requires php ^7.3.0 -> your PHP version (7.2.23) does not satisfy that requirement.

Why should php7.3 be read when Laravel himself says at least php7.2.5 ???

8 Answers

Run composer update.

The reason:

Your PHP version is too low. You've got 7.2.23 installed, and mockery/mockery 1.4 requires 7.3.0

The best solution is to upgrade your PHP version. Alternatively, you can reduce mockery's version to 1.3.1, which only requires PHP 5.6 or above.

My bug report can be found here

As of 2020-05-21, the zip files that laravel new ___ uses will try to install mockery/mockery version 1.4. This won't work with versions of PHP below 7.3. In order to fix this, run composer update, and mockery will be downgraded to a compatible version.

I had the same problem today for new Laravel projects. The composer.json file was showing "mockery/mockery": "^1.3.1" but still was showing the same error. Delete also the composer.lock file and run composer install.

Assuming you are trying to create a new laravel project called blog this is what I did to fix the error after running laravel new blog

  1. cd into blog

  2. run composer update

  3. Create a .env file. You can just make a copy of .env.example and rename the copy to .env. In case you try to start the dev server using php artisan serve and the app launches with a 500 error, run these commands:

    php artisan key:generate

    php artisan cache:clear

    php artisan config:clear

    composer dump-autoload

I had the problem when trying to create new Laravel applications,I updated php version using the following commands and it worked.

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt install -y php7.4 php7.4-gd php7.4-mbstring php7.4-xml

You can just run

composer create-project --prefer-dist laravel/laravel <project_name>

It'll automatically fall-back to mockery^1.3.1

Delete the composer.lock file and run composer again

composer install

I also faced these problems.

Problem 1 - Installation request for facade/ignition-contracts 1.0.2 -> satisfiable by facade/ignition-contracts[1.0.2]. - facade/ignition-contracts 1.0.2 requires php ^7.3|^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.

Problem 2 - Installation request for mockery/mockery 1.4.2 -> satisfiable by mockery/mockery[1.4.2]. - mockery/mockery 1.4.2 requires php ^7.3 || ^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.

Problem 3 - facade/ignition-contracts 1.0.2 requires php ^7.3|^8.0 -> your PHP version (7.2.34) does not satisfy that requirement. - nunomaduro/collision v4.2.0 requires facade/ignition-contracts ^1.0 -> satisfiable by facade/ignition-contracts[1.0.2]. - Installation request for nunomaduro/collision v4.2.0 -> satisfiable by nunomaduro/collision[v4.2.0].

I had deleted the composer.lock file and executed composer install command.

My problem solved.

This might be stale, the issue here is that the php needs to be updated to version that will be compatible.

  • delete the composer.lock file and autoload file in vendor i.e vendor/autoload in your project
  • upgrade php version from php.net
  • run composer install --no scripts
  • run composer update
  • php artisan migrate
  • php artisan key:generate
Related