【问题标题】:Ruby on rails stripe gemRuby on rails 条纹宝石
【发布时间】:2019-07-09 21:34:53
【问题描述】:

我正在尝试使用条带结帐。我在我的 gemfile 中添加了 gem 'stripe' 并运行了 bundle install。但是,当我再次尝试启动我的服务器时,我得到了这个错误。

我已尝试查看文档,但没有任何关于此错误的内容。

   Traceback (most recent call last):
42: from bin/rails:4:in `<main>'
41: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
40: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
39: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
38: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
37: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
36: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
35: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
34: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
33: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<main>'
32: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/command.rb:46:in `invoke'
31: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/command/base.rb:65:in `perform'
30: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
29: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
28: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
27: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `perform'
26: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `tap'
25: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:145:in `block in perform'
24: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
23: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
22: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
21: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
20: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
19: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
18: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
17: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
16: from /Users/kevinlopez/Desktop/rlab/rails/teamcarer/config/application.rb:7:in `<main>'
15: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
14: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
13: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
12: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
11: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
10: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
 9: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
 8: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
 7: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
 6: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
 5: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
 4: from /Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/stripe-4.9.0/lib/stripe.rb:6:in `<main>'
 3: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
 2: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
 1: from /Users/kevinlopez/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/Users/kevinlopez/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- faraday (LoadError) 

我希望启动我的服务器,以便我可以开始构建我的控制器和视图以进行支付,但我收到此错误。有人知道为什么会这样吗?

【问题讨论】:

标签: ruby-on-rails ruby stripe-payments


【解决方案1】:

该错误在最后一行表明没有满足 faraday 依赖项。值得补充的是:

gem 'faraday'

到您的Gemfile,然后添加bundle install

通常 gem 会声明它们自己的依赖项,以便它们自动加载,但在某些情况下这并不实用。

【讨论】:

  • hmm...我添加了这个运行的捆绑安装,但当我尝试启动服务器时仍然返回相同的错误
  • 法拉第也安装成功
  • 该目录中带有require 'bundler/setup'require 'faraday' 的快速脚本是否产生相同的错误?
  • 这可能是条带错误吗?
  • 看起来不像,更可能是您的 Ruby 无法找到 faraday 依赖项,即使在快速测试中它可以。我会尝试在另一个 Rails 项目中重现它,甚至是专门为此测试创建的项目。可能是 Rails "bootsnap"/Spring 对依赖项感到困惑,所以尝试bin/spring stop 看看是否会重置它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-03
  • 2013-07-15
  • 2012-05-08
  • 1970-01-01
  • 2016-04-01
  • 2017-07-09
相关资源
最近更新 更多