我要在我的laravel项目中安装作曲家,我有一个错误您的要求无法解决到可安装的软件包集。
我尝试了
/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].
潜在原因: - 包装名称中的错字 - 根据您的最低稳定性设置,该包在稳定版本中不可用 有关更多详细信息
Laravel不支持您的PHP版本。您有7.0.25 php,但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版本:
- 添加ondrej/php存储库:
sudo add-apt-repository ppa:ondrej/php
- 更新您的软件包列表:
sudo apt-get更新
- 安装PHP 7.3:
sudo apt安装php7.3 php7.3-common php7.3-cli
- 安装一些PHP 7.3扩展:
APT安装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
- 禁用PHP 7.0:
sudo a2dismod php7.0
- 启用PHP 7.3:
sudo a2enmod php7.3
- 完全从系统中删除PHP 7.0:
APT PURGE PHP7.0 PHP7.0-COMMON PHP7.0-CLI
这应该保存情况
composer install --ignore-platform-reqs
您需要更新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
我用此命令解决了这个问题,您只需要更新PHP的版本 composer update php
Windows用户