【发布时间】:2019-10-28 09:14:01
【问题描述】:
当我这样做时
rake db:migrate
它只是失败了。这是日志:
$ rake db:migrate
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/object/duplicable.rb:82: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
rake aborted!
SystemStackError: stack level too deep
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rest-client-2.0.2/lib/restclient/version.rb:3:in `map'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rest-client-2.0.2/lib/restclient/version.rb:3:in `<module:RestClient>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rest-client-2.0.2/lib/restclient/version.rb:1:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rest-client-2.0.2/lib/restclient.rb:7:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rest-client-2.0.2/lib/rest_client.rb:2:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/paypal-express-0.8.1/lib/paypal.rb:6:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/paypal-express-0.8.1/lib/paypal/express.rb:1:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:95:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:95:in `rescue in block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:72:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
/home/ubuntu/myproject/RubyOnRails/config/application.rb:7:in `<top (required)>'
/home/ubuntu/myproject/RubyOnRails/Rakefile:4:in `require'
/home/ubuntu/myproject/RubyOnRails/Rakefile:4:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
/home/ubuntu/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
Caused by:
LoadError: cannot load such file -- paypal-express
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
/home/ubuntu/myproject/RubyOnRails/config/application.rb:7:in `<top (required)>'
/home/ubuntu/myproject/RubyOnRails/Rakefile:4:in `require'
/home/ubuntu/myproject/RubyOnRails/Rakefile:4:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
/home/ubuntu/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)
我尝试了this答案中给出的建议:
- 我的 Gemfile 中已经有了 gem 'paypal-express'
-
我手动安装了
paypal-expressgem:gem 安装 paypal-express
仍然没有运气。 this question 的提问者给出了以下线索:
我需要从终端创建模型,以便运行迁移
但我不知道该怎么做(如果我想尝试的话)。 任何帮助将非常感激。 我是 RoR 的新手。
【问题讨论】:
-
您不需要运行
gem install paypal-express。这会在您的系统上全局安装 gem;但是这个项目使用了一组 restricted 宝石,在Gemfile中定义。相反,与项目中的所有其他 ruby 依赖项一样,您需要将它们安装为 bundle 的一部分。运行:bundle install. -
@TomLord 我已经做过
bundle install但没有运气 -
在运行
bundle exec rake db:migrate,而不是rake db:migrate时,您是否仍然遇到同样的错误? -
@TomLord:我刚刚尝试过,是的,我确实得到了完全相同的错误
-
你能发minimal reproducible example 来重现这个问题吗?例如。
Gemfile和Gemfile.lock,我可以在我的机器上使用它们来重现上述错误吗?
标签: ruby-on-rails ruby ruby-on-rails-4