(Rails新手)Rails服务器错误:无法加载此类文件-引导/设置(LoadError) [英] (New to Rails) rails server error: cannot load such file -- bootsnap/setup (LoadError)

查看:124
本文介绍了(Rails新手)Rails服务器错误:无法加载此类文件-引导/设置(LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将JS运行时安装为Node,并且已经捆绑了update-ed和bundle install-ed,但是仍然出现此错误:

I have installed my JS runtime as Node, and I have bundle update-ed and bundle install-ed, but I still get this error:

/Users/macbook/Documents/Studies/Coding/the_back_end/the_odin_project/odin_on_rails/hello_app/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
    from /Users/macbook/Documents/Studies/Coding/the_back_end/the_odin_project/odin_on_rails/hello_app/config/boot.rb:4:in `<top (required)>'
    from /Users/macbook/Documents/Studies/Coding/the_back_end/the_odin_project/odin_on_rails/hello_app/bin/rails:8:in `require_relative'
    from /Users/macbook/Documents/Studies/Coding/the_back_end/the_odin_project/odin_on_rails/hello_app/bin/rails:8:in `<top (required)>'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
    from /Users/macbook/.rvm/gems/ruby-2.3.4/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
    from /Users/macbook/Documents/Studies/Coding/the_back_end/the_odin_project/odin_on_rails/hello_app/bin/spring:15:in `require'
    from /Users/macbook/Documents/Studies/Coding/the_back_end/the_odin_project/odin_on_rails/hello_app/bin/spring:15:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

这是我的Gemfile中的内容,

Here's what's in my Gemfile ,

source 'https://rubygems.org'

gem 'rails',        '5.1.4'
gem 'puma',         '3.9.1'
gem 'sass-rails',   '5.0.6'
gem 'uglifier',     '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.7.0'


group :development, :test do
  gem 'sqlite3', '1.3.13'
  gem 'byebug',  '9.0.6', platform: :mri
end

group :development do
  gem 'web-console',           '3.5.1'
  gem 'listen',                '3.1.5'
  gem 'spring',                '2.0.2'
  gem 'spring-watcher-listen', '2.0.1'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

我对此感到有些迷茫,在任何地方都找不到任何有用的答案.

I feel a little lost on that one, and I can't find any helpful answer anywhere.

非常感谢!

推荐答案

gem bootsnap出现问题,其主要工作是加快Rails的启动时间.

You have an issue with the gem bootsnap which main job is to accelerate rails startup time.

因此,您应该:

  • 如果需要bootsnap,请将gem 'bootsnap'添加到gemfile进行安装.
  • 如果您不想使用bootsnap,请删除config/boot.rb中的行require 'bootsnap/setup'
  • In case you want bootsnap, add gem 'bootsnap' to your gemfile to install it.
  • In case you don't want bootsnap, remove the line require 'bootsnap/setup' in config/boot.rb

有关bootsnap的更多信息: https://github.com/Shopify /bootsnap#how-does-this-work

这篇关于(Rails新手)Rails服务器错误:无法加载此类文件-引导/设置(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆