[英]downgrading to rails 5.1.0 error
所以我想讓我的新rails項目專門使用gem rails 5.1.0,但是每次我創建“ rails new project”時,默認情況下,我的gemfile中將是rails 5.2.0。 所以我要做的是在我的gemfile中手動將其更改為rails 5.1.0。 但是,每次執行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)
我是Rails的新手,所以我不知道是否錯過了某些事情或做錯了什么。 希望有人能對此有所啟發。
先感謝您。
在您的應用程序中將gem 'rails', '~> 5.1'
到gem文件
嘗試刪除Gemfile.lock並重新執行捆綁更新事件機
我解決了自己的問題。
我使用以下命令在系統上進行了Rails的干凈卸載
gem uninstall rails
gem uninstall railties
並再次安裝了我想要的寶石。
工作完美。
如果您的系統中安裝了多個版本的Rails,則可以通過運行以下命令指定用於創建新應用程序的Rails版本:
rails _version_ new APP_NAME
例如,如果要使用Rails 5.1.0,請運行:
rails _5.1.0_ new APP_NAME
然后將為您創建一個新的Rails 5.1.0應用程序。 確保已安裝Rails的版本:
gem list \^rails\$
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.