$ Composer 找不到 mongodb 扩展,需要 Mongodb 扩展

2022-01-21 00:00:00 macos mongodb php composer-php lumen-5.4

我在 macOS Mojave/macOS Big Sur/macOS Monterey 上使用最新的 php 版本 7.2 并收到类似的错误

 $composer 需要 mongodb/mongodb对 mongodb/mongodb 使用版本 ^1.4./composer.json 已更新使用包信息加载作曲家存储库更新依赖项(包括 require-dev)

<块引用>

有关问题的更多信息:请参阅屏幕截图

<块引用>

您的要求无法解决为一组可安装的包.

<块引用>

问题 1- mongodb/mongodb v1.4.x-dev 需要 ext-mongodb ^1.5.0 ->您的系统中缺少请求的 PHP 扩展 mongodb.- mongodb/mongodb 1.5.x-dev 需要 ext-mongodb ^1.6 ->您的系统中缺少请求的 PHP 扩展 mongodb.- mongodb/mongodb 1.4.2 需要 ext-mongodb ^1.5.0 ->您的系统中缺少请求的 PHP 扩展 mongodb.- mongodb/mongodb 1.4.1 需要 ext-mongodb ^1.5.0 ->您的系统中缺少请求的 PHP 扩展 mongodb.- mongodb/mongodb 1.4.0 需要 ext-mongodb ^1.5.0 ->您的系统中缺少请求的 PHP 扩展 mongodb.**- mongodb/mongodb ^1.4 的安装请求 ->可由 mongodb/mongodb[1.4.0, 1.4.1, 1.4.2, 1.5.x-dev, v1.4.x-dev] 满足.

安装失败,正在将 ./composer.json 还原为其原始内容.

我已经安装了 mongoDB 扩展仍然收到问题

不确定我错过了哪些安装步骤.如果有人可以帮助我解决这个作曲家问题,我将不胜感激.提前谢谢.

解决方案

composer 需要 mongodb/mongodb --ignore-platform-reqs

composer 需要 mongodb/mongodb --ignore-platform-reqs作曲家需要 jensegers/mongodb --ignore-platform-reqs为 jenssegers/mongodb 使用版本 ^3.4./composer.json 已更新使用包信息加载作曲家存储库更新依赖项(包括 require-dev)包操作:2 次安装、0 次更新、0 次删除- 安装 mongodb/mongodb (1.4.2): 下载 (100%)- 安装 jensegers/mongodb (v3.4.5): 下载 (100%)jenssegers/mongodb 建议安装 jenssegers/mongodb-session (将 MongoDB 会话支持添加到 Laravel-MongoDB)jenssegers/mongodb 建议安装 jenssegers/mongodb-sentry (向 Laravel-MongoDB 添加 Sentry 支持)写锁文件生成优化的自动加载文件

composer 需要 jenssegers/mongodb --ignore-platform-reqs它解决了我的问题.

I'm using with latest php version 7.2 on macOS Mojave / macOS Big Sur / macOS Monterey and receiving error like

 $composer require mongodb/mongodb
Using version ^1.4 for mongodb/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

For more information about question : see the screenshoot

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

Problem 1 - mongodb/mongodb v1.4.x-dev requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.5.x-dev requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.4.2 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.4.1 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system. **- Installation request for mongodb/mongodb ^1.4 -> satisfiable by mongodb/mongodb[1.4.0, 1.4.1, 1.4.2, 1.5.x-dev, v1.4.x-dev].

Installation failed, reverting ./composer.json to its original content.

I have already installed mongoDB extension still receiving problem

Not sure what I've missed steps to installation. If anyone can help me with this composer problem, I'd greatly appreciate it. in advance Thanks.

解决方案

composer require mongodb/mongodb --ignore-platform-reqs

composer require mongodb/mongodb --ignore-platform-reqs
composer require jenssegers/mongodb --ignore-platform-reqs

Using version ^3.4 for jenssegers/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing mongodb/mongodb (1.4.2): Downloading (100%)         
  - Installing jenssegers/mongodb (v3.4.5): Downloading (100%)         
jenssegers/mongodb suggests installing jenssegers/mongodb-session (Add MongoDB session support to Laravel-MongoDB)
jenssegers/mongodb suggests installing jenssegers/mongodb-sentry (Add Sentry support to Laravel-MongoDB)
Writing lock file
Generating optimized autoload files

composer require jenssegers/mongodb --ignore-platform-reqs It solved my problem.

相关文章