Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`require': cannot load such file -- bootsnap/setup (LoadError) #73

Closed
bhanuone opened this issue Jul 10, 2017 · 16 comments
Closed

`require': cannot load such file -- bootsnap/setup (LoadError) #73

bhanuone opened this issue Jul 10, 2017 · 16 comments

Comments

@bhanuone
Copy link

I just followed the setup process mentioned in the README and got this error.

confit/boot.rb

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup'

Error stack

home/bhanu/workspace/truckola/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
	from /home/bhanu/workspace/truckola/config/boot.rb:4:in `<top (required)>'
	from /home/bhanu/workspace/truckola/bin/rails:8:in `require_relative'
	from /home/bhanu/workspace/truckola/bin/rails:8:in `<top (required)>'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
	from /home/bhanu/.rbenv/versions/2.3.1/gemsets/truckola/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
	from /home/bhanu/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
	from /home/bhanu/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
	from /home/bhanu/workspace/truckola/bin/spring:13:in `<top (required)>'
	from bin/rails:3:in `load'
	from bin/rails:3:in `<main>'

@jules2689
Copy link
Contributor

What is in your Gemfile?

@nicolasmlv
Copy link

I have the same issue

Gemfile
gem 'bootsnap', require: false

boot.rb

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup'
require 'bootsnap/setup'
Gemfile.lock

  GIT
  remote: git://github.com/plataformatec/devise.git
  revision: 5e014ab6072551f6c39c391340e6b2089c849d00
  specs:
    devise (4.3.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.2)
      responders
      warden (~> 1.2.3)

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.1.0)
      actionpack (= 5.1.0)
      nio4r (~> 2.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.1.0)
      actionpack (= 5.1.0)
      actionview (= 5.1.0)
      activejob (= 5.1.0)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.1.0)
      actionview (= 5.1.0)
      activesupport (= 5.1.0)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.1.0)
      activesupport (= 5.1.0)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.1.0)
      activesupport (= 5.1.0)
      globalid (>= 0.3.6)
    activemodel (5.1.0)
      activesupport (= 5.1.0)
    activerecord (5.1.0)
      activemodel (= 5.1.0)
      activesupport (= 5.1.0)
      arel (~> 8.0)
    activesupport (5.1.0)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (8.0.0)
    autoprefixer-rails (7.0.1)
      execjs
    av (0.9.0)
      cocaine (~> 0.5.3)
    aws-sdk (2.9.17)
      aws-sdk-resources (= 2.9.17)
    aws-sdk-core (2.9.17)
      aws-sigv4 (~> 1.0)
      jmespath (~> 1.0)
    aws-sdk-resources (2.9.17)
      aws-sdk-core (= 2.9.17)
    aws-sigv4 (1.0.0)
    bcrypt (3.1.11)
    benchmark-ips (2.7.2)
    bindex (0.5.0)
    bootsnap (0.2.12)
      msgpack (~> 1.0)
      snappy (~> 0.0.15)
    browser (2.4.0)
    builder (3.2.3)
    byebug (9.0.6)
    chartkick (2.2.3)
    climate_control (0.1.0)
    cocaine (0.5.8)
      climate_control (>= 0.0.3, < 1.0)
    coderay (1.1.1)
    coffee-rails (4.2.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.2.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    connection_pool (2.2.1)
    dalli (2.7.6)
    derailed (0.1.0)
      derailed_benchmarks
    derailed_benchmarks (1.3.2)
      benchmark-ips (~> 2)
      get_process_mem (~> 0)
      heapy (~> 0)
      memory_profiler (~> 0)
      rack (>= 1)
      rake (> 10, < 13)
      thor (~> 0.19)
    devise-i18n (1.1.2)
    did_you_mean (1.1.2)
    domain_name (0.5.20170404)
      unf (>= 0.0.5, < 1.0.0)
    elasticsearch (5.0.4)
      elasticsearch-api (= 5.0.4)
      elasticsearch-transport (= 5.0.4)
    elasticsearch-api (5.0.4)
      multi_json
    elasticsearch-transport (5.0.4)
      faraday
      multi_json
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    erubi (1.6.0)
    eventmachine (1.2.3)
    execjs (2.7.0)
    faraday (0.11.0)
      multipart-post (>= 1.2, < 3)
    fast_blank (1.0.0)
    fcm (0.0.2)
      httparty
      json
    ffi (1.9.18)
    figaro (1.1.1)
      thor (~> 0.14)
    font_assets (0.1.14)
      rack
    formatador (0.2.5)
    friendly_id (5.2.1)
      activerecord (>= 4.0.0)
    get_process_mem (0.2.1)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    groupdate (3.2.0)
      activesupport (>= 3)
    guard (2.14.1)
      formatador (>= 0.2.4)
      listen (>= 2.7, < 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-livereload (2.5.2)
      em-websocket (~> 0.5)
      guard (~> 2.8)
      guard-compat (~> 1.0)
      multi_json (~> 1.8)
    guard-minitest (2.4.6)
      guard-compat (~> 1.2)
      minitest (>= 3.0)
    hashie (3.5.5)
    heapy (0.1.2)
    honeybadger (3.1.2)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    http_parser.rb (0.6.0)
    httparty (0.15.5)
      multi_xml (>= 0.5.2)
    i18n (0.8.1)
    jmespath (1.3.1)
    jquery-rails (4.3.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-slick-rails (1.6.0.2)
      railties (>= 3.1)
    jquery-turbolinks (2.1.0)
      railties (>= 3.1.0)
      turbolinks
    json (2.1.0)
    jwt (1.5.6)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.12)
    mail (2.6.5)
      mime-types (>= 1.16, < 4)
    mailgun_rails (0.9.0)
      actionmailer (>= 3.2.13)
      json (>= 1.7.7)
      rest-client (>= 1.6.7)
    memory_profiler (0.9.8)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mimemagic (0.3.2)
    mini_magick (4.7.0)
    mini_portile2 (2.1.0)
    minitest (5.10.2)
    minitest-ci (3.2.0)
      minitest (>= 5.0.6)
    msgpack (1.1.0)
    multi_json (1.12.1)
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    nenv (0.3.0)
    net-ldap (0.16.0)
    netrc (0.11.0)
    nio4r (2.0.0)
    nokogiri (1.7.2)
      mini_portile2 (~> 2.1.0)
    notiffany (0.1.1)
      nenv (~> 0.1)
      shellany (~> 0.0)
    oauth2 (1.3.1)
      faraday (>= 0.8, < 0.12)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    omniauth (1.6.1)
      hashie (>= 3.4.6, < 3.6.0)
      rack (>= 1.6.2, < 3)
    omniauth-facebook (4.0.0)
      omniauth-oauth2 (~> 1.2)
    omniauth-oauth2 (1.4.0)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    orm_adapter (0.5.0)
    paperclip (5.1.0)
      activemodel (>= 4.2.0)
      activesupport (>= 4.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (~> 0.3.0)
    paperclip-av-transcoder (0.6.4)
      av (~> 0.9.0)
      paperclip (>= 2.5.2)
    pg (0.20.0)
    pry (0.10.4)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    puma (3.8.2)
    rack (2.0.2)
    rack-protection (2.0.0)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.1.0)
      actioncable (= 5.1.0)
      actionmailer (= 5.1.0)
      actionpack (= 5.1.0)
      actionview (= 5.1.0)
      activejob (= 5.1.0)
      activemodel (= 5.1.0)
      activerecord (= 5.1.0)
      activesupport (= 5.1.0)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.1.0)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails_autolink (1.1.6)
      rails (> 3.1)
    railties (5.1.0)
      actionpack (= 5.1.0)
      activesupport (= 5.1.0)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    rb-fsevent (0.9.8)
    rb-inotify (0.9.8)
      ffi (>= 0.5.0)
    redcarpet (3.4.0)
    redis (3.3.3)
    responders (2.4.0)
      actionpack (>= 4.2.0, < 5.3)
      railties (>= 4.2.0, < 5.3)
    rest-client (2.0.2)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    rolify (5.1.0)
    ruby-prof (0.16.2)
    ruby_dep (1.5.0)
    sass (3.4.23)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    searchjoy (0.3.1)
      activerecord (>= 4)
      chartkick (>= 2)
      groupdate (>= 3)
    searchkick (2.3.0)
      activemodel (>= 4.1)
      elasticsearch (>= 1)
      hashie
    shellany (0.0.1)
    sidekiq (5.0.0)
      concurrent-ruby (~> 1.0)
      connection_pool (~> 2.2, >= 2.2.0)
      rack-protection (>= 1.5.0)
      redis (~> 3.3, >= 3.3.3)
    slop (3.6.0)
    snappy (0.0.15)
    spring (2.0.1)
      activesupport (>= 4.2)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    stackprof (0.2.10)
    streamio-ffmpeg (3.0.2)
      multi_json (~> 1.8)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.3)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.4)
    warden (1.2.7)
      rack (>= 1.0)
    web-console (3.5.0)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    will_paginate (3.1.5)

PLATFORMS
  ruby

DEPENDENCIES
  autoprefixer-rails
  aws-sdk
  bootsnap
  browser
  byebug
  coffee-rails
  dalli
  derailed
  devise!
  devise-i18n
  did_you_mean
  fast_blank
  fcm
  figaro
  font_assets
  friendly_id
  groupdate
  guard
  guard-livereload (~> 2.5)
  guard-minitest
  honeybadger
  jquery-rails
  jquery-slick-rails
  jquery-turbolinks
  listen
  mailgun_rails
  mini_magick
  minitest-ci
  net-ldap
  omniauth
  omniauth-facebook
  paperclip
  paperclip-av-transcoder
  pg
  puma
  rails
  rails_autolink
  redcarpet
  rolify
  ruby-prof
  sass-rails
  searchjoy
  searchkick
  sidekiq
  spring
  spring-watcher-listen
  stackprof
  streamio-ffmpeg
  turbolinks
  uglifier
  web-console
  will_paginate

RUBY VERSION
   ruby 2.4.0p0

BUNDLED WITH
   1.15.1

Gemfile

source 'https://rubygems.org'

ruby '2.4.0'

gem 'font_assets'
gem 'redcarpet'
gem 'paperclip'
gem 'paperclip-av-transcoder'
gem 'sidekiq'

gem 'devise', github: 'plataformatec/devise'#https://github.com/plataformatec/devise/issues/4518

gem 'rails'

gem 'turbolinks'

gem 'fast_blank'

#webserver
gem 'puma'

#memcache
gem 'dalli'

#db
gem 'pg'
gem 'rolify'
gem 'groupdate'
gem 'friendly_id'

#JS/CSS
gem 'jquery-rails'
gem 'coffee-rails'
gem 'autoprefixer-rails'
gem 'jquery-turbolinks'
gem "jquery-slick-rails"

gem 'omniauth'
gem 'omniauth-facebook'

gem 'aws-sdk'
gem 'sass-rails'

#search
gem 'searchkick'
gem 'searchjoy'

#view helpers
gem 'rails_autolink'
gem 'will_paginate'

gem 'devise-i18n'

gem 'mailgun_rails'

#for variants
gem 'browser'

gem 'honeybadger'

gem 'net-ldap'

gem 'fcm'

gem 'bootsnap', require: false

group :development, :test do
  gem 'byebug'
  gem 'guard'
  gem 'guard-minitest'
  gem 'ruby-prof'
  gem 'minitest-ci'
end

# only web app
group :webdyno do
  gem 'uglifier'
end

#only worker app
group :workerdyno, :development do
  gem "mini_magick"# gem "rmagick" http://stackoverflow.com/a/16529378/1348593
  gem 'streamio-ffmpeg'
end

#only dev (local) app
group :development do
  gem 'figaro'
  gem 'did_you_mean'
  gem 'derailed'
  gem 'stackprof'
  # gem "bullet" <- to try

  gem 'web-console'
  gem 'listen'

  gem 'spring'
  gem 'spring-watcher-listen'

  gem 'guard-livereload','~> 2.5', require: false
end

rails s (or rails c) :

/Users/me/code/my-project/my-project-web/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
	from /Users/me/code/my-project/my-project-web/config/boot.rb:4:in `<top (required)>'
	from bin/rails:3:in `require_relative'
	from bin/rails:3:in `<main>'

@jules2689
Copy link
Contributor

@nicolasmlv you are using bootsnap (0.2.12) which did not include this file. We are now on bootsnap 1.1.2 (After jumping from 0.3.x which introduced bootsnap/setup).

Please run bundle update bootsnap :)

@nicolasmlv
Copy link

ok it works, I think you can close the issue

@Ericfreespirit
Copy link

Hello world ! I did the bundle update bootsnap but it give me :
Using msgpack 1.2.4
Using bootsnap 1.3.2
Using bundler 1.16.4
Bundler attempted to update bootsnap but its version stayed the same
Bundle updated!

Can anyone help me ?

@kgaikwad
Copy link

Facing similar issue:
``ruby-2.4.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require': cannot load such file -- rails/commands (LoadError)
`

Ruby (2.4.3)
Rails (5.2.1)
msgpack (1.2.4)
bootsnap (1.3.2)

Any pointers?

@jules2689
Copy link
Contributor

@Ericfreespirit @kgaikwad can you open new issues and please include the full error output? :) Thanks!

@cdmo
Copy link

cdmo commented Sep 21, 2018

I had a string of various LoadErrors and clearing the bootsnap cache finally cleared the load errors for me. Here's how I did that:

  • go to the project home, then cd into tmp/cache
  • delete bootsnap-load-path-cache and bootsnap-compile-cache

h/t #53

Not sure if deleting both the directory and the binary file there are necessary, perhaps you only have to clear one? Regardless, clearing it out got rid of load errors.

@Ericfreespirit
Copy link

Sorry I found the solution, I installed just the wrong rails version ...
Thank you all

@dogaoz
Copy link

dogaoz commented May 7, 2020

In our case, we didn't have wrong rails version installed and this still happened. Even removing

  • rvm ruby installation and re-installing it didn't fix it
  • bundle install other bundle commands. Nothing helps it.
  • 'gem pristine --all` doesn't work as well.

because gems are okay and everything else is installed correctly.

Only way to get rid of random LoadErrors is deleting the files below IN THE APP.
-app/tmp/cache/bootsnap-load-path-cache
-app/tmp/cache/bootsnap-compile-cache

This still happens with the newest bootsnap 1.4.6. For some reason, it doesn't clean up the load path cache after new gem installations or updates. I'm not sure the logic behind it.

@dogaoz dogaoz mentioned this issue May 7, 2020
Closed
shellandbull pushed a commit to deliveroo/roo_on_rails that referenced this issue May 22, 2020
shellandbull pushed a commit to deliveroo/roo_on_rails that referenced this issue May 26, 2020
* DEFF-565 replace calls to logger.with with just logger

* rubocop fixes

* more rubocop fixes

* DEFF-565 rubocop fixes

* rubocop

* set auth method to trust

* DEFF-565 skip bootsnap -> Shopify/bootsnap#73

* set base config for db

* set password to nothing and dbname to the one matching database.yml file

* DEFF-565 snap cache

* DEFF-565 set auth method

set uset to postgres

propagate config to other containers, this is the step prior to a refactor

ignore support folder

* DEFF-565 cleanup

* DEFF-565 refactor
aiandrox added a commit to aiandrox/hashlog that referenced this issue Feb 1, 2021
aiandrox added a commit to aiandrox/hashlog that referenced this issue Feb 9, 2021
aiandrox added a commit to aiandrox/hashlog that referenced this issue Feb 9, 2021
@rafaelsales
Copy link

rm -rf .bundle; bundle install solved for me

@Hushcobbler
Copy link

  • bootsnap-load-path-cache

how do i delete the files

@riyanpratamap
Copy link

It happened every I call rails on my project folder. Even right after I created fresh new project.
rm -rf .bundle; bundle install did not work on mine. Any ideas?

$ rails --version
/Users/mac/Devs/Rails/test/rails-test-api/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
	from /Users/mac/Devs/Rails/test/rails-test-api/config/boot.rb:4:in `<top (required)>'
	from bin/rails:3:in `require_relative'
	from bin/rails:3:in `<main>'

ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]

rails --version (this also give me those error, so I move to non rails project folder and excecute this)
Rails 7.0.4

bootsnap
bootsnap-1.13.0

@headmandev
Copy link

headmandev commented Nov 21, 2022

@riyanpratamap
I got almost the same issue with "require_relative".
Nothing helped, so I decided to update ruby-build

 brew upgrade ruby-build

and rebuild the Ruby by rbenv.

rbenv install ruby 2.7.5 # do not forget to delete it before

and it helped.

I think this issue is connected to the Mac OS update (Ventura in my case)

@sixty4bit
Copy link

I was getting the following error:

/Users/sixty4bit/.rvm/gems/ruby-3.1.3/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- listen (LoadError)

I solved this by adding the listen gem to my Gemfile.

gem 'listen'

Oddly, I didn't even need to do a bundle install after. I accidentally forgot to run bundle install and just started rails s. And it worked.

To test, I removed the gem 'listen' and then ran rails s again and it died. Same error. Readded the gem, ran bundler install, then rails s. It works. If I remove the gem 'listen' line from my Gemfile it breaks. 🤷

@hhokaribonx
Copy link

rm -rf .bundle; bundle install solved for me

The issue occurred (in hindsight) when I was moving around and stashing while experimenting gems (adding/removing gems in Gemfile). This seems to have cleared the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests