Help us understand the problem. What is going on with this article?

composer requireで「Your requirements could not be resolved to an installable set of packages.」エラーが出たときの対処法。

More than 1 year has passed since last update.

問題

composer require 〇〇でパッケージをインストールしようと以下のエラーが出てインストールができない。

Using version ^1.0 for abraham/twitteroauth
./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
    - abraham/twitteroauth 1.0.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - abraham/twitteroauth 1.0.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - Installation request for abraham/twitteroauth ^1.0 -> satisfiable by abraham/twitteroauth[1.0.0, 1.0.1].
  To enable extensions, verify that they are enabled in your .ini files:
    - C:\php-7.3.5-nts-Win32-VC15-x64\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.

解決策

エラーの内容を見るとcurlが見当たらないことが問題らしい。

the requested PHP extension curl is missing from your system.

php.iniを開き、curlのコメントアウトを外し。有効化すればインストールが可能になる。

;extension=curl
↓
extension=curl

参考

composerで怒られた. the requested PHP extension curl is missing from your system
https://kengotakimoto.com/post-2754/

GUTTY
ねこ
yyphp
PHPerが毎週集まり、ざっくばらんに情報交換する雑談コミュニティ
https://yyphp.connpass.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away