简体   繁体   English

Spree Commerce 设置错误:“未知版本...(运行时错误)”

[英]Spree Commerce Setup Error: “Unknown Version…(Runtime Error)”

I am going through the open-source Spree commerce tutorial .我正在阅读开源的 Spree commerce 教程 I am new to Ruby, so I just installed Ruby 2.7.2 and Rails 6.1.我是 Ruby 的新手,所以我刚刚安装了 Ruby 2.7.2 和 Rails 6.1。 Unfortunately, Spree doesn't support Rails 6.1 yet, as described here: Bundler could not find compatible versions for gem “rails”... .不幸的是,Spree 还不支持 Rails 6.1,如下所述: Bundler could not find compatible versions for gem "rails"... So, I followed the solutions provided on that SO post and modified my Gemfile to set rails (and railties) to 6.0.3.因此,我遵循了该 SO 帖子中提供的解决方案,并修改了我的 Gemfile 以将 rails(和 railties)设置为 6.0.3。 That seemed to fix the error mentioned on that SO post...这似乎解决了该 SO 帖子中提到的错误......

But now when trying to run the command from the tutorial "bundle exec rails g spree:install --user_class=Spree::User", I'm getting the error:但是现在当尝试从教程“bundle exec rails g spree:install --user_class=Spree::User”运行命令时,我收到了错误:

C:/Program Files/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-6.0.3/lib/rails/application/configuration.rb:156:in `load_defaults': Unknown version "6.1" (RuntimeError) C:/Program Files/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-6.0.3/lib/rails/application/configuration.rb:156:in `load_defaults': 未知版本“6.1” (运行时错误)

Why is this happening, and how do I resolve this error?为什么会发生这种情况,我该如何解决这个错误?

Thank you in advance!先感谢您!

Get to the config/application.rb file in your app's folder and set the line with获取应用程序文件夹中的config/application.rb文件并设置行

config.load_defaults 6.1

to the below到下面

config.load_defaults 6.0

The problem is, when you initially ran rails new command, the generators set the rails version to 6.1, which doesn't change when you specified 6.0.0 as version in Gemfile.问题是,当您最初运行rails new命令时,生成器将 rails 版本设置为 6.1,当您在 Gemfile 中指定 6.0.0 作为版本时,该版本不会更改。

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

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