简体   繁体   English

更新的bootstrap gem无法加载到rails中

[英]Updated bootstrap gem can't be loaded in rails

Bootstrap used to work wonderfully on Rails! Bootstrap曾经在Rails上运行得非常好! Now I'm getting a really weird error. 现在我得到了一个非常奇怪的错误。

I was using an older version of the Bootstrap gem before (if I remember correctly, it was 4.1.3). 之前我正在使用较旧版本的Bootstrap gem(如果我没记错的话,它是4.1.3)。 However, Github gave me this concerning alert when I pushed my rails app: 但是,当我推送我的rails应用程序时,Github给了我关于警报的信息:

In Bootstrap 4 before 4.3.1 and Bootstrap 3 before 3.4.1, XSS is possible in the tooltip or popover data-template attribute. 在4.3.1之前的Bootstrap 4和3.4.1之前的Bootstrap 3中,可以在工具提示或弹出框数据模板属性中使用XSS。 For more information, see: https://blog.getbootstrap.com/2019/02/13/bootstrap-4-3-1-and-3-4-1/ 有关详细信息,请参阅: https//blog.getbootstrap.com/2019/02/13/bootstrap-4-3-1-and-3-4-1/

Understood, it happens I suppose. 明白了,我想是的。 The logical thing to do now is to update my gemfile so that the bootstrap gem dependency statement looks like this: 现在要做的逻辑是更新我的gemfile,以便bootstrap gem依赖语句如下所示:

gem "bootstrap", ">= 4.3.1"

Easy enough. 很容易。 Once I added that, ran bundle install , and restarted my server, I got this error: 一旦我添加了,运行bundle install ,并重新启动我的服务器,我收到此错误:

/Users/myusername/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': cannot load such file -- bootstrap (LoadError)

Weird right? 奇怪吧? I'm actually getting this error in two different contexts: 我实际上是在两个不同的上下文中得到这个错误:

  1. I have a rails engine, that also relies on bootstrap, that I'm using as a gem in my app. 我有一个rails引擎,它也依赖于bootstrap,我在我的应用程序中用作宝石。 I get this error whenever I try adding the most updated version of the bootstrap gem as a dependency. 每当我尝试添加最新版本的bootstrap gem作为依赖项时,我都会收到此错误。
  2. I also get this error when adding bootstrap to my gemfile just like you would with any regular gem and application. 将bootstrap添加到我的gemfile时也会出现这个错误,就像使用常规gem和应用程序一样。

How could I go about fixing this error? 我怎么能修复这个错误? Any help is appreciated! 任何帮助表示赞赏!

Here is my full stack trace 这是我的完整堆栈跟踪

Traceback (most recent call last):
    59: from bin/rails:3:in `<main>'
    58: from bin/rails:3:in `load'
    57: from /Users/angelgarcia/Documents/Dev/websites/search-analysis-tool/bin/spring:15:in `<top (required)>'
    56: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:65:in `require'
    55: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:65:in `require'
    54: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
    53: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
    52: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
    51: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
    50: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
    49: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
    48: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
    47: from /Users/angelgarcia/Documents/Dev/websites/search-analysis-tool/bin/rails:9:in `<top (required)>'
    46: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
    45: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
    44: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
    43: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    42: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    41: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    40: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    39: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    38: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
    37: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
    36: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
    35: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    34: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    33: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    32: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `perform'
    31: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `tap'
    30: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:145:in `block in perform'
    29: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
    28: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
    27: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
    26: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    25: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    24: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    23: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    22: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    21: from /Users/angelgarcia/Documents/Dev/websites/search-analysis-tool/config/application.rb:7:in `<top (required)>'
    20: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler.rb:114:in `require'
    19: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
    18: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
    17: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
    16: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
    15: from /Users/angelgarcia/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:81:in `block (2 levels) in require'
    14: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    13: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    12: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    11: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    10: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
     9: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/bundler/gems/elko-engine-f7b39674f535/lib/elko.rb:5:in `<top (required)>'
     8: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
     7: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
     6: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
     5: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:26:in `require'
     4: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:40:in `rescue in require'
     3: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
     2: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
     1: from /Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/angelgarcia/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': cannot load such file -- bootstrap (LoadError)

Looks like a problem with bootsnap gem . 看起来像bootsnap gem有问题。 Try to remove its cache 尝试删除其缓存

rm -rf tmp/cache/bootsnap*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM