更新 Composer 时出错

Posted

技术标签:

【中文标题】更新 Composer 时出错【英文标题】:getting error while updating Composer 【发布时间】:2016-08-27 00:23:25 【问题描述】:

我在 Laravel-5.1 有一个项目,我已将我的平台从 win10 更改为 Ubuntu。

显示错误:

使用包信息加载作曲家存储库

更新依赖(包括require-dev)

您的需求无法解决为一组可安装的软件包。

  Problem 1
- laravel/framework v5.2.9 requires ext-mbstring * -> the requested php extension mbstring is missing from your system.
- laravel/framework v5.2.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.31 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.30 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.29 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.27 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.26 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.25 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.24 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.23 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.22 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.21 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.20 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.19 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.18 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.17 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.16 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.14 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.13 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.12 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.10 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.2.30 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- Installation request for laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].

To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/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.

作曲家/json。


"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": 
  "php": ">=5.5.9",
  "laravel/framework": "5.2.*",
  "infyomlabs/laravel-generator": "dev-master",
  "laravelcollective/html": "5.2.*",
  "infyomlabs/core-templates": "dev-master",
  "infyomlabs/swagger-generator": "dev-master",
  "jlapp/swaggervel": "dev-master",
  "doctrine/dbal": "~2.3",
  "infyomlabs/generator-builder": "dev-master",
  "yajra/laravel-datatables-oracle": "~6.0",
  "barryvdh/laravel-ide-helper": "^2.1",
  "infyomlabs/adminlte-templates": "dev-master"
,
"require-dev": 
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "symfony/css-selector": "2.8.*|3.0.*",
    "symfony/dom-crawler": "2.8.*|3.0.*"
,
"autoload": 
    "classmap": [
        "database"
    ],
    "psr-4": 
        "App\\": "app/"
    
,
"autoload-dev": 
    "classmap": [
        "tests/TestCase.php"
    ]
,
"scripts": 
    "post-root-package-install": [
        "php -r \"copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
,
"config": 
    "preferred-install": "dist"

【问题讨论】:

嗨@kkpatel,请举一个最小的工作示例,您为解决问题所做的工作。 @Andy K 需要在 php.ini 文件中为 php7.0 和 beet change 安装 mbstring 、 yum 和 xml。 詹姆斯给了你答案。不是您为找到问题所做的工作 【参考方案1】:

您的错误消息非常明确地说明出了什么问题:

laravel/framework v5.2.9 需要 ext-mbstring * -> 您的系统中缺少请求的 PHP 扩展 mbstring。

您的服务器上是否安装了mbstring 并且已启用?

您可以将mbstring 作为 libapache2-mod-php5 软件包的一部分安装:

sudo apt-get install libapache2-mod-php5

或独立使用:

sudo apt-get install php-mbstring

安装它也将启用它,但是您也可以通过编辑您的 php.ini 文件来启用它,如果已安装它,则删除注释掉它的 ;

如果这是在您的本地计算机上,请按照相应的步骤在您的环境中安装它。

【讨论】:

如果我错了,请纠正我:并删除 ; 将其注释掉您的意思是取消注释,因为分号表示评论,对吧? @SaiyanPrince 我已经编辑了我的答案 - 但我的意思是说,有分号目前正在评论它 @James 感谢您提供澄清,但您的编辑没有做出任何更改。从我的角度来看,我仍然不清楚..它应该是取消评论而不是评论.. @SaiyanPrince “评论它的;”在这种情况下是正确的英文。 为什么 composer 不自动下载库 ext-mbstring?我以为它是包管理器?【参考方案2】:

对于 php7 你可以这样做:

sudo apt-get install php-gd php-xml php7.0-mbstring

【讨论】:

对于 php 7.2 我使用了 sudo apt-get install php-gd php-xml php7.2-mbstring 终于!非常感谢您,好心的先生。【参考方案3】:

在 php7.2 Ubuntu 18.04 LTS 和 ubuntu 19.04 中

sudo apt-get install php-gd php-xml php7.2-mbstring

像魅力一样工作

【讨论】:

【参考方案4】:

如果您将 php 7.3 用于 laravel 5.7。这对我有用

sudo apt-get install php-gd php-xml php7.3-mbstring

【讨论】:

这是唯一对我有用的方法,我正在使用:PHP 版本 7.2.24-1 + ubuntu16.04.1 + deb.sury.org + Laravel 5.8.35【参考方案5】:

此错误的快速解决方案

运行这个命令

composer install --ignore-platform-reqs

此命令不考虑操作系统或平台

【讨论】:

它对我有用。 Composer 正在检查平台要求,但实际上已经满足了要求。运行此命令后,一切正常 欢迎@Buraco。【参考方案6】:

根据给定的答案安装软件包后,我仍然遇到一些错误,然后我安装以下软件包并且它工作正常:

php-xml

具体版本:

php7.0-xml

php 7.0

的命令
sudo apt-get install php7.0-xml

在某些情况下,您还需要一个包 php7.0-common 。和上面的命令一样安装。

【讨论】:

看来php版本在这里很重要...我尝试了几次使用php-xml而不是php7.*-xml。【参考方案7】:

Ubuntu 已经有了很多好的答案。我在 Linux 上遇到了同样的问题,但上面的命令都不适合我。

对于 Linux 和 php70,我使用了以下命令,效果很好:

sudo yum install php70-mbstring -y

【讨论】:

【参考方案8】:

这适用于我的 php 7.2

sudo apt-get install php7.2-xml

【讨论】:

【参考方案9】:

问题:

Problem 1
    - laravel/framework v5.8.38 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.8.38 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.8.38 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - Installation request for laravel/framework (locked at v5.8.38, required as 5.8.*) -> satisfiable by laravel/framework[v5.8.38].

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp\php\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

解决方案: 如果您使用 xampp,只需删除 ' ; '来自

;extension=mbstring

在 php.ini 中,保存,完成!

【讨论】:

【参考方案10】:

在php7.4中

sudo apt-get install php-gd php-xml php7.4-mbstring

【讨论】:

以上是关于更新 Composer 时出错的主要内容,如果未能解决你的问题,请参考以下文章

安装 Hyperledger Composer 时出错

Laravel 5.2 - 使用 composer 和 git bash 安装 laravel 时出错

尝试自我更新作曲家时出错

VMware Horizon7 添加view composer域时出错

使用 composer 安装包时出错,但包似乎已安装

尝试安装 symfony 2 composer 时出错 [重复]