4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Rails】Herokuのエラー「cannot load such file -- bootsnap/setup (LoadError)」を解決する

Posted at

課題

Herokuにデプロイした際に下記エラーが出てデプロイができませんでした。

!     Could not detect rake tasks
!     ensure you can run `$ bundle exec rake -P` against your app
!     and using the production group of your Gemfile.
!     /tmp/build_68e54361/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)

原因

Herokuではbundlerがバージョン2.1.4までしか使えず、ローカル環境とherokuの環境でbundlerのバージョンが違うことが原因であると考えました。

実際に自身のGemfile.lockは以下のようになっており、2.2.2が設定されていました。

Gemfile.lock
RUBY VERSION
   ruby 2.6.5p114

BUNDLED WITH
   2.2.2

解決策

上記原因を解決するために、bundler2.1.4でもう1度bundle installを行えば解決できると考えました。

① bundlerのインストール状況を確認する

$ gem list bundler

*** LOCAL GEMS ***
bundler (default: 2.2.2, 2.1.4)

② バージョン2.1.4があるのでバージョンを指定してインストールする

$ bundle _2.1.4_ install

この後、変更内容をpushしてHerokuでデプロイを行ったら掲題課題を解決することができました!!

4
1
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
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?