0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ruby 3.4 にアップデートしたときのエラー対応(標準添付ライブラリの bundled gem 対応)

Last updated at Posted at 2025-01-14

対応内容

定期スクリプトで Ruby 3.3 から Ruby 3.4 にアップデートしたら以下のエラーが出て失敗した。

'Kernel.require': cannot load such file -- csv

csv は Ruby の標準添付ライブラリの中の bundled gem です。

Ruby 3.4 からは bundler を利用している場合、bundled gem は Gemfile に記述する必要がある。

Gemfile に以下を追加したら、エラーが解消した。

gem 'csv'

bundled gem は Ruby のインストール時同梱しているため、通常追加でインストールにはならない。個別でアップデートやアンインストールはできる。

参考ドキュメント

Ruby Standard Library

標準添付ライブラリの中の Default gems と Bundled gems についての説明がある。今回の csv は Bundled gems に含まれる。

gem がどちらに分類されているかはこちらのドキュメントを参照できる。

Default gems

  • Default gems are shipped with Ruby releases and also available as rubygems.
  • Default gems are not uninstallable from the Ruby installation.
  • Default gems can be updated using rubygems.
  • Default gems can be used with bundler environments like unbundled_env.
  • Default gems can be used at any version in a Gemfile.

Rubyのリリースに同梱されており、rubygemsとしても利用できる。
アンインストールできない。

Bundled gems

Bundled gems are shipped with Ruby releases and also available as rubygems.

  • They are only bundled with Ruby releases.
  • They can be uninstalled from the Ruby installation.
  • They need to be declared in a Gemfile when used with bundler.

Rubyのリリースに同梱されており、rubygemsとしても利用できる。
アンインストールできる。

bundler で使用する場合は、Gemfile で宣言する必要がある。

Ruby 用語集

default gem

標準添付ライブラリーの gem のうち、アンインストールできないもの。

bundled gem

標準添付ライブラリーの gem のうち、アンインストールできるもの。

こちらには bundler での宣言の必要について記載されていないように見えた。

標準添付ライブラリー

Ruby 本体と一緒に配布される、組込みではないライブラリー。
インストールせずに使うことができる。
gem 形式になっているものとなっていないものがあるが、なっているものは standard gem と呼ばれ、Ruby 本体のバージョンとは独立してアップデートすることができる。 standard gem はさらに、アンインストールのできない default gem とアンインストールできる bundled gem に分けられる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?