tag:crieit.net,2005:https://crieit.net/tags/JWT/feed 「JWT」の記事 - Crieit Crieitでタグ「JWT」に投稿された最近の記事 2021-07-14T20:39:52+09:00 https://crieit.net/tags/JWT/feed tag:crieit.net,2005:PublicArticle/17517 2021-07-14T20:39:52+09:00 2021-07-14T20:39:52+09:00 https://crieit.net/posts/composer-lcobucci-jwt-require-ext-sodium-20210714 lcobucci/jwt を Composer でインストールしようとしたら Your requirements could not be resolved to an installable set of packages. のエラーメッセージ <p><a target="_blank" rel="nofollow noopener" href="https://packagist.org/packages/lcobucci/jwt">lcobucci/jwt</a> を Composer でインストールしようとしたら以下のエラーメッセージが表示されました。</p> <pre><code class="bash">> composer require Search for a package: ./composer.json has been updated Running composer update Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires lcobucci/jwt 4.1.4 -> satisfiable by lcobucci/jwt[4.1.4]. - lcobucci/jwt 4.1.4 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension. To enable extensions, verify that they are enabled in your .ini files: - PATH\TO\xampp\php\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. </code></pre> <p>XAMPP (PHP 7.4.3) に <code>ext-sodium</code> の拡張機能がない、と。 Docker を使っても良いのですが、今回はサクッと試したいだけなのでもう少し見てみます。試しに <code>php.ini</code> を確認すると</p> <pre><code class="ini">;extension=soap ;extension=sockets ;extension=sodium ;extension=sqlite3 ;extension=tidy ;extension=xmlrpc ;extension=xsl </code></pre> <p>何かそれらしきものがコメントアウトされているのを発見。</p> <pre><code class="ini">;extension=soap ;extension=sockets extension=sodium ;extension=sqlite3 ;extension=tidy ;extension=xmlrpc ;extension=xsl </code></pre> <p>コメントアウトを外し、 XAMPP のコントロールパネルから Apache を再起動。</p> <p>それから再度 Composer でインストールをかけると、正常に完了しました。</p> <h2 id="参考"><a href="#%E5%8F%82%E8%80%83">参考</a></h2> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://packagist.org/packages/lcobucci/jwt">lcobucci/jwt - Packagist</a></li> <li>同種のエラーメッセージへの対処: <a target="_blank" rel="nofollow noopener" href="https://qiita.com/wallkickers/items/e895495172b5e7371f38">【PHP】「〜requires ext-gd * -> the requested PHP extension gd is missing from your system.」でパッケージがインストールできない時の解決法。 - Qiita</a></li> </ul> arm-band