我要在laravel项目中安装composer,但出现类似错误 您的要求无法解决为一组可安装的软件包。
我尝试过
/var/www/html/pro $ composer install
然后我得到
Problem 1
- This package requires php ^7.1.3 but your PHP version (7.0.25) does not satisfy that requirement.
Problem 2
- Installation request for joshbrw/laravel-module-installer ^0.1.4 -> satisfiable by joshbrw/laravel-module-installer[v0.1.4].
- joshbrw/laravel-module-installer v0.1.4 requires composer-plugin-api ^1.1 -> no matching package found.
Problem 3
- laravel/framework v5.7.9 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.8 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.7 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.6 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.5 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.4 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.3 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.28 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.27 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.26 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.25 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.24 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.23 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.22 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.21 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.20 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.2 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.19 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.18 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.17 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.16 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.15 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.14 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.13 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.12 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.11 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.10 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.1 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.0 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework 5.7.x-dev requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- Installation request for laravel/framework 5.7.* -> satisfiable by laravel/framework[5.7.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.12, v5.7.13, v5.7.14, v5.7.15, v5.7.16, v5.7.17, v5.7.18, v5.7.19, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.24, v5.7.25, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
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.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
similarly i tried
/var/www/html/prol $ composer require spatie/laravel-medialibrary
Got error
Using version ^6.9 for spatie/laravel-medialibrary
./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
- This package requires php ^7.1.3 but your PHP version (7.0.25) does not satisfy that requirement.
Problem 2
- Installation request for joshbrw/laravel-module-installer ^0.1.4 -> satisfiable by joshbrw/laravel-module-installer[v0.1.4].
- joshbrw/laravel-module-installer v0.1.4 requires composer-plugin-api ^1.1 -> no matching package found.
Problem 3
- laravel/framework v5.7.9 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.8 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.7 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.6 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.5 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.4 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.3 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.28 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.27 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.26 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.25 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.24 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.23 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.22 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.21 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.20 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.2 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.19 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.18 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.17 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.16 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.15 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.14 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.13 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.12 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.11 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.10 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.1 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.7.0 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework 5.7.x-dev requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
- Installation request for laravel/framework 5.7.* -> satisfiable by laravel/framework[5.7.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.12, v5.7.13, v5.7.14, v5.7.15, v5.7.16, v5.7.17, v5.7.18, v5.7.19, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.24, v5.7.25, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
潜在原因: -包裹名称中有错字 -根据您的最低稳定性设置,该软件包没有足够稳定的版本 有关更多详细信息,请参见https://getcomposer.org/doc/04-schema.md#minimum-stability。
答案 0 :(得分:2)
laravel不支持您的php版本。 您有php 7.0.25,但laravel需要最低php 7.1.3。
解决方案:将您的php升级到7.1.3
最新laravel版本的服务器要求:
PHP >= 7.1.3
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension
BCMath PHP Extension
来源:https://laravel.com/docs/5.8#server-requirements
您可以使用以下命令升级php版本:
sudo add-apt-repository ppa:ondrej / php
sudo apt-get更新
sudo apt安装php7.3 php7.3-常见php7.3-cli
易于安装php7.3-bcmath php7.3-bz2 php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-readline php7.3-xml php7.3-zip
sudo a2dismod php7.0
sudo a2enmod php7.3
apt清除php7.0 php7.0-常见php7.0-cli
答案 1 :(得分:1)
您需要更新您的php版本。使用以下行更新php
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.1 //install php version 7.1 or other(5.6, 7.2)
sudo a2dismod php7.0 //Disable php 7.0
sudo a2enmod php7.1 //Enable php version 7.1
答案 2 :(得分:0)
我用此命令解决了这个问题,您只需要更新php版本
composer update php