Cannot install laravel with composer - laravel

I try to use the following command on my macos terminal,
composer global require laravel/installer
And I get the following error,
Problem 1
- laravel/installer v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].
I have tried the following solution, but that doesn't work for me,
Can't install laravel installer via composer

check your php version and update via homebrew
brew update
brew upgrade php

Related

Is there anyone who can help me to install maatwebsite/excel

I have tried to install composer require maatwebsite/excel and I have tried several times but still getting errors and I'm using laravel 9.23.0 and PHP v8.0.5 here is the error.
Using version ^3.1 for maatwebsite/excel
./composer.json has been updated
Running composer update maatwebsite/excel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- maatwebsite/excel[3.1.36, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, ..., 1.24.1].
- maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.0.5) does not satisfy that requirement.
- maatwebsite/excel[3.1.26, ..., 3.1.35] require illuminate/support 5.8.*|^6.0|^7.0|^8.0 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it
conflicts with another require.
- phpoffice/phpspreadsheet[1.18.0, ..., 1.24.1] require ext-gd * -> it is missing from your system. Install or enable PHP's
gd extension.
- Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-gd to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require maatwebsite/excel:*" to figure out if any version is installable, or "composer require maatwebsite/excel:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
According to docs the requirements are:
PHP: ^7.2\|^8.0
Laravel: ^5.8|^6.0|^7.0|^8.0
PhpSpreadsheet: ^1.21
psr/simple-cache: ^1.0
PHP extension php_zip enabled
PHP extension php_xml enabled
PHP extension php_gd2 enabled
PHP extension php_iconv enabled
PHP extension php_simplexml enabled
PHP extension php_xmlreader enabled
PHP extension php_zlib enabled
Go to the php.ini file by you xampp console. Search this ;extension=gd and remove ; then restart the server.
Check if the other php extension are enabled to.
As the error message mentioning it the PHP GD extension is missing on your system.
Google for install php gd for you system windows, mac, linux and follow the installation instructions.
For linux it will be:
sudo apt-get install php8.0-gd
If you are using a docker container, then you can use the following:
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions gd
After the gd extension is installed try to install the package again. If it fails check if there is another package missing and install it in a similar way.

Composer failure when installing Laravel 5.8 + Voyager

I installed laravel 5.8, and then i did composer require tcg/voyager:1.3.2. I didn't used composer require tcg/voyager cause apparently it doesn't supports laravel 5.8. However it keeps failling and throwing this problem:
Problem 1
- Can only install one of: league/flysystem[1.1.3, 1.0.x-dev].
- Can only install one of: league/flysystem[1.0.x-dev, 1.1.3].
- Can only install one of: league/flysystem[1.0.x-dev, 1.1.3].
- tcg/voyager v1.3.2 requires league/flysystem ~1.0.41 -> satisfiable by league/flysystem[1.0.x-dev].
- Installation request for tcg/voyager 1.3.2 -> satisfiable by tcg/voyager[v1.3.2].
- Installation request for league/flysystem 1.1.3 -> satisfiable by league/flysystem[1.1.3].
I tried first installing composer require league/flysystem:1.1.3 before voyager but still it fails with the same error. Am at the lost here.
Have you checked whether league/flysystem has been installed before? According to that error message it is installed in v1.1.3, while tcg/voyager requires v1.0.* - this is not compatible.
v1.1 of the flysystem is pretty new, and only the current dev branches of Voyager contain fixes for this.
To resolve this situation, you could run composer require league/flysystem:"~1.0.41"

laravel new blog not work mockery/mockery 1.4.0

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 ???
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
cd into blog
run composer update
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
Delete the composer.lock file and run composer again
composer install
You can just run
composer create-project --prefer-dist laravel/laravel <project_name>
It'll automatically fall-back to mockery^1.3.1
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

Trying to install laravel/ui composer is failing

I am trying to install the laravel/ui for Laravel 6.4, but when I try to install through composer I get the error message Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package laravel/framework (locked at v6.4.0, required as ^5.0) is satisfiable by laravel/framework[v6.4.0], but these conflict with your requirements or minimum-stability.
Problem 2
- laravel/framework v5.0.9 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
...
...
...
To enable extensions, verify that they are enabled in your .ini files:
...
Installation failed, reverting ./composer.json to its original content.
I have tried to install it manually as well, but to no avail. composer.json : composer.json
If mcrypt or ext-mcrypt is not enabled open your php.ini and search for
;extension=php_mcrypt.so
then remove the ; from the beginning of that line. Same procedure for the other extension.
source to find and open the file path; Laravel requires the Mcrypt PHP extension

How to fix issue for install laravel 5.6?

I upgrade PHP 7.0 to 7.1 in ubuntu 16.04.
I need install laravel 5.6, but show this error:
But after run composer create-project --prefer-dist laravel/laravel blog in terminal show this error:
Installing laravel/laravel (v5.6.0)
- Installing laravel/laravel (v5.6.0): Loading from cache
Created project in orouji6
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
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
- phpunit/phpunit 7.1.x-dev requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 7.0.x-dev requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 7.0.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 7.0.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- Installation request for phpunit/phpunit ~7.0 -> satisfiable by phpunit/phpunit[7.0.0, 7.0.1, 7.0.x-dev, 7.1.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.1/cli/php.ini
- /etc/php/7.1/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.1/cli/conf.d/10-opcache.ini
- /etc/php/7.1/cli/conf.d/10-pdo.ini
- /etc/php/7.1/cli/conf.d/20-calendar.ini
- /etc/php/7.1/cli/conf.d/20-ctype.ini
- /etc/php/7.1/cli/conf.d/20-exif.ini
- /etc/php/7.1/cli/conf.d/20-fileinfo.ini
- /etc/php/7.1/cli/conf.d/20-ftp.ini
- /etc/php/7.1/cli/conf.d/20-gettext.ini
- /etc/php/7.1/cli/conf.d/20-iconv.ini
- /etc/php/7.1/cli/conf.d/20-json.ini
- /etc/php/7.1/cli/conf.d/20-mbstring.ini
- /etc/php/7.1/cli/conf.d/20-mysqli.ini
- /etc/php/7.1/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.1/cli/conf.d/20-phar.ini
- /etc/php/7.1/cli/conf.d/20-posix.ini
- /etc/php/7.1/cli/conf.d/20-readline.ini
- /etc/php/7.1/cli/conf.d/20-shmop.ini
- /etc/php/7.1/cli/conf.d/20-sockets.ini
- /etc/php/7.1/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.1/cli/conf.d/20-sysvsem.ini
- /etc/php/7.1/cli/conf.d/20-sysvshm.ini
- /etc/php/7.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
How to fix this problem?
Thanks
You need to install php dom extension.
sudo apt-get install php7.1-xml
You are missing the dom PHP extension. You need to install that to be able to use phpunit version 7 and above (which Laravel 5.6 requires in development environment).
If you're using Debian or Ubuntu, you can install it with apt install php7.1-xml.

Resources