启动新项目的Rails服务器时遇到一些问题。我已经成功启动了同一文件夹中项目的Rails服务器。我在文件夹之外尝试了此操作,问题仍然存在。我已经更新了ruby,更新了RVM,更新了捆绑程序版本,但仍然无济于事。
这是我不断收到的错误:
Traceback (most recent call last):
27: from bin/rails:3:in `<main>'
26: from bin/rails:3:in `load'
25: from /Users/semira/rails_studio/admin/bin/spring:15:in `<top (required)>'
24: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
23: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
22: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
21: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
20: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
19: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
18: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
17: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
16: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
15: from /Users/semira/rails_studio/admin/bin/rails:8:in `<top (required)>'
14: from /Users/semira/rails_studio/admin/bin/rails:8:in `require_relative'
13: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `<top (required)>'
12: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `require'
11: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `<top (required)>'
10: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `require_relative'
9: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `<top (required)>'
8: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `require_relative'
7: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `<top (required)>'
6: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `require_relative'
5: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
4: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/explicit_require.rb:40:in `with_gems'
3: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
2: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `require'
1: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:9:in `<top (required)>'
/Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
28: from bin/rails:3:in `<main>'
27: from bin/rails:3:in `load'
26: from /Users/semira/rails_studio/admin/bin/spring:15:in `<top (required)>'
25: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
24: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
23: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
22: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
21: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
20: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
19: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
18: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
17: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
16: from /Users/semira/rails_studio/admin/bin/rails:8:in `<top (required)>'
15: from /Users/semira/rails_studio/admin/bin/rails:8:in `require_relative'
14: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `<top (required)>'
13: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `require'
12: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `<top (required)>'
11: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `require_relative'
10: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `<top (required)>'
9: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `require_relative'
8: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `<top (required)>'
7: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `require_relative'
6: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
5: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/explicit_require.rb:40:in `with_gems'
4: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
3: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `require'
2: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:8:in `<top (required)>'
1: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:11:in `require': incompatible library version - /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack/msgpack.bundle (LoadError)
28: from bin/rails:3:in `<main>'
27: from bin/rails:3:in `load'
26: from /Users/semira/rails_studio/admin/bin/spring:15:in `<top (required)>'
25: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
24: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
23: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
22: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
21: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
20: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
19: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
18: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
17: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
16: from /Users/semira/rails_studio/admin/bin/rails:8:in `<top (required)>'
15: from /Users/semira/rails_studio/admin/bin/rails:8:in `require_relative'
14: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `<top (required)>'
13: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `require'
12: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `<top (required)>'
11: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `require_relative'
10: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `<top (required)>'
9: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `require_relative'
8: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `<top (required)>'
7: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `require_relative'
6: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
5: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/explicit_require.rb:39:in `with_gems'
4: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/explicit_require.rb:43:in `rescue in with_gems'
3: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
2: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `require'
1: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:9:in `<top (required)>'
/Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
29: from bin/rails:3:in `<main>'
28: from bin/rails:3:in `load'
27: from /Users/semira/rails_studio/admin/bin/spring:15:in `<top (required)>'
26: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
25: from /Users/semira/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
24: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
23: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
22: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
21: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
20: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
19: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
18: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
17: from /Users/semira/rails_studio/admin/bin/rails:8:in `<top (required)>'
16: from /Users/semira/rails_studio/admin/bin/rails:8:in `require_relative'
15: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `<top (required)>'
14: from /Users/semira/rails_studio/admin/config/boot.rb:4:in `require'
13: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `<top (required)>'
12: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/setup.rb:1:in `require_relative'
11: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `<top (required)>'
10: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap.rb:3:in `require_relative'
9: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `<top (required)>'
8: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache.rb:67:in `require_relative'
7: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
6: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/explicit_require.rb:39:in `with_gems'
5: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/explicit_require.rb:43:in `rescue in with_gems'
4: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
3: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/store.rb:3:in `require'
2: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:8:in `<top (required)>'
1: from /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack.rb:11:in `require': incompatible library version - /Users/semira/.rvm/gems/ruby-2.6.0/gems/msgpack-1.2.6/lib/msgpack/msgpack.bundle (LoadError)
答案 0 :(得分:0)
在启动rails server
时,我也遇到了同样的问题。因此,我安装了最新的msgpack
宝石,这解决了我的问题。使用以下命令安装最新版本的gem msgpack
gem install msgpack -v 1.3.1
答案 1 :(得分:0)
此问题的主要原因是不兼容的gem版本。当gem版本在两个不同的rails项目之间发生冲突时,会发生此问题。我建议您使用Ruby Version Manager rvm
,该版本可用于为每个Rails项目创建虚拟环境。
如何避免这些问题:
rvm gemset
,可为您提供分隔的独立红宝石设置。示例:
rvm
后,您可以使用命令rvm install ruby-2.6.3
下载任何版本的ruby rvm use 2.6.3
激活特定的红宝石版本。test_project
,还要确保创建一个具有相同名称的gemset
。例如:rvm gemset create test_project
rvm use 2.6.3@test_project
激活游戏集。gem install bundler
和bundle install
注意:
gemset
。例如:rvm use 2.6.3@test_project
希望这可以解决您的问题。