无法 运行 ruby 控制台

Unable to run ruby console

我正在尝试遵循 graphql rails 教程,但我 运行 遇到了一些问题。我是 rails 的新手,一般不会遇到这么多问题。根据我所做的研究,Ruby 2.6+ 可能存在问题,但是,其他解决方案中的 none 对我有用。

堆栈跟踪:

>rails c
Traceback (most recent call last):
bin/rails: Bootsnap::LoadPathCache::FallbackScan
        74: from bin/rails:4:in `<main>'
        73: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
        72: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
        71: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
        70: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        69: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        68: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        67: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        66: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
        65: from /home/alexis/.gem/ruby/2.6.0/gems/railties-6.0.1/lib/rails/commands.rb:18:in `<main>'
        64: from /home/alexis/.gem/ruby/2.6.0/gems/railties-6.0.1/lib/rails/command.rb:46:in `invoke'
        63: from /home/alexis/.gem/ruby/2.6.0/gems/railties-6.0.1/lib/rails/command/base.rb:65:in `perform'
        62: from /home/alexis/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        61: from /home/alexis/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        60: from /home/alexis/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        59: from /home/alexis/.gem/ruby/2.6.0/gems/railties-6.0.1/lib/rails/commands/console/console_command.rb:101:in `perform'
        58: from /home/alexis/.gem/ruby/2.6.0/gems/railties-6.0.1/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
        57: from /home/alexis/.gem/ruby/2.6.0/gems/railties-6.0.1/lib/rails/command/actions.rb:22:in `require_application!'
        56: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
        55: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
        54: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
        53: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        52: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        51: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        50: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        49: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
        48: from /home/alexis/Documents/rails-tutorial/config/application.rb:20:in `<main>'
        47: from /home/alexis/.gem/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:114:in `require'
        46: from /home/alexis/.gem/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `require'
        45: from /home/alexis/.gem/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `each'
        44: from /home/alexis/.gem/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `block in require'
        43: from /home/alexis/.gem/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `each'
        42: from /home/alexis/.gem/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
        41: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        40: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        39: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        38: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        37: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
        36: from /usr/lib/ruby/gems/2.6.0/gems/graphql-1.9.16/lib/graphql.rb:86:in `<main>'
        35: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
        34: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
        33: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
        32: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        31: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        30: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        29: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        28: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
        27: from /usr/lib/ruby/gems/2.6.0/gems/graphql-1.9.16/lib/graphql/schema.rb:24:in `<main>'
        26: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
        25: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
        24: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
        23: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        22: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        21: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        20: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        19: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
        18: from /usr/lib/ruby/gems/2.6.0/gems/graphql-1.9.16/lib/graphql/schema/member.rb:32:in `<main>'
        17: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
        16: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
        15: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
        14: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        13: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        12: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        11: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        10: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
         9: from /usr/lib/ruby/gems/2.6.0/gems/graphql-1.9.16/lib/graphql/schema/member/has_fields.rb:2:in `<main>'
         8: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
         7: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
         6: from /home/alexis/.gem/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
         5: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:26:in `require'
         4: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:40:in `rescue in require'
         3: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
         2: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
         1: from /usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/usr/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': cannot load such file -- irb/ruby-token (LoadError)
>gem list
*** LOCAL GEMS ***

actioncable (6.0.1)
actionmailbox (6.0.1)
actionmailer (6.0.1)
actionpack (6.0.1)
actiontext (6.0.1)
actionview (6.0.1)
activejob (6.0.1)
activemodel (6.0.1)
activerecord (6.0.1)
activestorage (6.0.1)
activesupport (6.0.1)
addressable (2.7.0)
bigdecimal (default: 1.4.1)
bindex (0.8.1)
bootsnap (1.4.5)
builder (3.2.4)
bundler (2.0.2)
byebug (11.0.1)
capybara (3.29.0)
childprocess (3.0.0)
cmath (default: 1.0.0)
concurrent-ruby (1.1.5)
crass (1.0.5)
csv (default: 3.0.9)
date (default: 2.0.0)
dbm (default: 1.0.0)
e2mmap (default: 0.1.0)
erubi (1.9.0)
etc (default: 1.0.1)
fcntl (default: 1.0.0)
ffi (1.11.3)
fiddle (default: 1.0.0)
fileutils (default: 1.1.0)
forwardable (default: 1.2.0)
gdbm (default: 2.0.0)
globalid (0.4.2)
graphiql-rails (1.5.0)
graphql (1.9.16, 1.8.13)
i18n (1.7.0)
io-console (default: 0.4.7)
ipaddr (default: 1.2.2)
irb (1.2.0, 1.1.0)
jbuilder (2.9.1)
json (default: 2.1.0)
listen (3.1.5)
logger (default: 1.3.0)
loofah (2.4.0)
mail (2.7.1)
marcel (0.3.3)
matrix (default: 0.1.0)
method_source (0.9.2)
mimemagic (0.3.3)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.13.0)
msgpack (1.3.1)
mutex_m (default: 0.1.0)
nio4r (2.5.2)
nokogiri (1.10.7)
openssl (default: 2.1.2)
ostruct (default: 0.1.0)
parslet (1.8.2)
pg (1.1.4)
prime (default: 0.1.0)
psych (default: 3.1.0)
public_suffix (4.0.1)
puma (4.3.1)
rack (2.0.7)
rack-proxy (0.6.5)
rack-test (1.1.0)
rails (6.0.1)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.3.0)
railties (6.0.1)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
regexp_parser (1.6.0)
reline (0.0.7)
rexml (default: 3.1.9)
rss (default: 0.2.7)
ruby_dep (1.5.0)
rubyzip (2.0.0)
sass-rails (6.0.0)
sassc (2.2.1)
sassc-rails (2.1.2)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
selenium-webdriver (3.142.6)
shell (default: 0.7)
spring (2.1.0)
spring-watcher-listen (2.0.1)
sprockets (4.0.0)
sprockets-rails (3.2.1)
sqlite3 (1.4.1)
stringio (default: 0.0.2)
strscan (default: 1.0.0)
sync (default: 0.5.0)
thor (0.20.3)
thread_safe (0.3.6)
thwait (default: 0.1.0)
tilt (2.0.10)
tracer (default: 0.1.0)
trollop (2.9.10)
turbolinks (5.2.1)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
web-console (4.0.1)
webdrivers (4.1.3)
webpacker (4.2.2)
webrick (default: 1.4.2)
websocket-driver (0.7.1)
websocket-extensions (0.1.4)
xpath (3.2.0)
yarn (0.1.1)
zeitwerk (2.2.2)
zlib (default: 1.0.0)

如果我可以提供任何其他信息,请告诉我。正如我所说,我是 Ruby 的新手,其中包括有用的诊断信息。

查看堆栈跟踪,这绝对是 Bootsnap 的问题,它可能与 ruby(2.6.5 - 10 月 19 日发布)和 [=19 的前沿版本有关=] 6.0.1(11 月 19 日发布)。

也看到这个 thread,我建议将您的 ruby 版本降级到 2.5 血统并重试,如果您正在做一个新教程,我​​相信即使是rails 的现代版本,如 5.6.2 也可以流畅地工作。

尝试在 RVM 或 RBenv 之间安装多个 versions/switch - 这会让您的 ruby upgrade/downgrade 生活更轻松。