[英]downgrading to rails 5.1.0 error
So I want to have my new rails project to be using gem rails 5.1.0 specifically, but each time I do create a "rails new project", by default it will be rails 5.2.0 in my gemfile. 所以我想让我的新rails项目专门使用gem rails 5.1.0,但是每次我创建“ rails new project”时,默认情况下,我的gemfile中将是rails 5.2.0。 So what I do is I will manually change it to rails 5.1.0 in my gemfile.
所以我要做的是在我的gemfile中手动将其更改为rails 5.1.0。 However, I will get this result each time i do a bundle exec rails c:
但是,每次执行bundle exec rails c时,我都会得到以下结果:
Traceback (most recent call last):
62: from bin/rails:4:in `<main>'
61: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
60: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
59: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
58: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
57: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
56: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
55: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
54: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
53: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/commands.rb:16:in `<main>'
52: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/command.rb:44:in `invoke'
51: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/command/base.rb:63:in `perform'
50: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
49: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
48: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
47: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/commands/console/console_command.rb:84:in `perform'
46: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
45: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/application.rb:329:in `require_environment!'
44: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
43: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
42: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
41: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
40: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
39: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
38: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
37: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
36: from /Users/YickTing/ecommerce/config/environment.rb:5:in `<main>'
35: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/application.rb:353:in `initialize!'
34: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/initializable.rb:58:in `run_initializers'
33: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
32: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
31: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
30: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
29: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
28: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
27: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `each_strongly_connected_component_from'
26: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `call'
25: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/initializable.rb:48:in `tsort_each_child'
24: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/initializable.rb:48:in `each'
23: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
22: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
21: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
20: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
19: from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
18: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/initializable.rb:59:in `block in run_initializers'
17: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/initializable.rb:30:in `run'
16: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/initializable.rb:30:in `instance_exec'
15: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/engine.rb:599:in `block in <class:Engine>'
14: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/engine.rb:599:in `each'
13: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>'
12: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
11: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
10: from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
9: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
8: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
7: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
6: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
5: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
4: from /Users/YickTing/ecommerce/config/environments/development.rb:1:in `<main>'
3: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/railtie.rb:211:in `configure'
2: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/railtie.rb:211:in `instance_eval'
1: from /Users/YickTing/ecommerce/config/environments/development.rb:31:in `block in <main>'
/usr/local/lib/ruby/gems/2.5.0/gems/railties-5.1.0/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_storage' for #<Rails::Application::Configuration:0x00007f817e09e258> (NoMethodError)
I am pretty new to rails so I dont know if there's something I missed out or something I do wrongly. 我是Rails的新手,所以我不知道是否错过了某些事情或做错了什么。 Hopefully someone could enlighten me on this.
希望有人能对此有所启发。
Thank you in advance. 先感谢您。
add gem 'rails', '~> 5.1'
to gem file in your App 在您的应用程序中将
gem 'rails', '~> 5.1'
到gem文件
Try remove Gemfile.lock and re-do a bundle update eventmachine 尝试删除Gemfile.lock并重新执行捆绑更新事件机
I fixed my own issue. 我解决了自己的问题。
I ran a clean uninstallation of rails on my system using 我使用以下命令在系统上进行了Rails的干净卸载
gem uninstall rails
gem uninstall railties
And installed the gem I want again. 并再次安装了我想要的宝石。
Worked perfectly. 工作完美。
If you have multiple versions of rails installed in your system, you can specify which version of Rails to create a new app with by running: 如果您的系统中安装了多个版本的Rails,则可以通过运行以下命令指定用于创建新应用程序的Rails版本:
rails _version_ new APP_NAME
For example, if you want to use Rails 5.1.0 you'd run: 例如,如果要使用Rails 5.1.0,请运行:
rails _5.1.0_ new APP_NAME
and a new rails 5.1.0 application will be created for you. 然后将为您创建一个新的Rails 5.1.0应用程序。 Ensure you have the version of rails installed:
确保已安装Rails的版本:
gem list \^rails\$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.