laravel 更新 Composer 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36979019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:19:53  来源:igfitidea点击:

getting error while updating Composer

laravellaravel-5.1laravel-5.2

提问by Ketan Akbari

I have a project in Laravel-5.1 and I have changed my platform from win10 to Ubuntu.

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

Showing error:

显示错误:

Loading composer repositories with package information

Updating dependencies (including require-dev)

Your requirements could not be resolved to an installable set of packages.

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

更新依赖项(包括 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.

Composer/json.

作曲家/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"
}

}

}

回答by James

Your error message is pretty explicit about what is going wrong:

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

laravel/framework v5.2.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

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

Do you have mbstringinstalled on your server and is it enabled?

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

You can install mbstringas part of the libapache2-mod-php5 package:

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

sudo apt-get install libapache2-mod-php5

sudo apt-get install libapache2-mod-php5

Or standalone with:

或独立使用:

sudo apt-get install php-mbstring

sudo apt-get install php-mbstring

Installing it will also enable it, however you can also enable it by editing your php.inifile and remove the ;that is commenting it out if it is already installed.

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

If this is on your local machine, then follow the appropriate steps to install this on your environment.

如果这是在您的本地计算机上,则按照适当的步骤将其安装在您的环境中。

回答by Ibrahima Timera

for php7 you can do that:

对于 php7,你可以这样做:

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

回答by Ian Samz

In php7.2 Ubuntu 18.04 LTS and ubuntu 19.04

在 php7.2 Ubuntu 18.04 LTS 和 ubuntu 19.04

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

Works like a Charm

奇迹般有效

回答by Fil

If you're using php 7.3 for laravel 5.7. this work for me

如果你在 laravel 5.7 上使用 php 7.3。这对我有用

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

回答by J4GD33P 51NGH

After installing packages from given answers, i still get some errors then i install following package and it works fine:

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

  • php-xml
  • php-xml

for specific version:

对于特定版本:

  • php7.0-xml
  • php7.0-xml

command for php 7.0

php 7.0 的命令

sudo apt-get install php7.0-xml

in some cases you also needs a package php7.0-common. install it same as above command.

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

回答by daniel

A lot of good answers already for Ubuntu. I'm on Linux and had the same problem but none of the commands above worked for me.

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

With Linux and php70 I used the following command which worked great:

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

sudo yum install php70-mbstring -y

sudo yum install php70-mbstring -y

回答by nanichang

This works for me with php 7.2

这适用于我的 php 7.2

sudo apt-get install php7.2-xml

sudo apt-get install php7.2-xml

回答by Katheeskumar

The good solution for this error please run this command

此错误的良好解决方案请运行此命令

composer install --ignore-platform-reqs

composer install --ignore-platform-reqs