ruby 无法启动Rails控制台-无法加载这样的文件“ext/save-history.rb”

vql8enpb  于 11个月前  发布在  Ruby
关注(0)|答案(1)|浏览(118)

我最近将我的Rails 7.0.4应用程序从Ruby 2.7.5升级到3.2.2
一切正常-我可以运行服务器,测试等-但我不能启动Rails控制台。当我启动控制台时,我得到这个错误:

/Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- /Users/my-user-name/src/ext/save-history.rb (LoadError)

字符串
我首先认为这是一个Bootsnap错误,但当我在config/boot.rb中注解掉require 'bootsnap/setup'时,我得到了一个类似但不同的错误:

/Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/dead_end-1.1.6/lib/dead_end/auto.rb:30:in `require': cannot load such file -- /Users/my-user-name/src/ext/save-history.rb (LoadError)
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/dead_end-1.1.6/lib/dead_end/auto.rb:30:in `require_relative'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb/extend-command.rb:368:in `save_history='
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb/context.rb:137:in `initialize'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:473:in `new'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:473:in `initialize'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:419:in `new'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:419:in `start'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:70:in `start'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:19:in `start'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:102:in `perform'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'


这似乎是Irb会话试图加载库以保存我的Irb历史的一个问题?我已经尝试卸载ruby并重新安装,重新安装所有gem与replayer,似乎没有什么变化。
我不知道问题是什么-这是一个ruby的问题,一个blackler的问题,一个gems的问题,和OSX的问题?
我正在使用
1.简体中文

  1. Ruby 3.2.2
  2. Bundler 2.3.20
  3. Rubygems 3.4.10
  4. Rails 7.0.4
    值得注意的是,我部署到Heroku,我可以启动Heroku控制台没有任何问题。
u3r8eeie

u3r8eeie1#

Dead_end -> syntax_suggest

这很可能是一个红色的鲱鱼,但你可以尝试迁移dead_end gem。
dead_end gem已重命名为syntax_suggest,并且是ruby3.2中的默认gem。请参阅自述文件部分进行重命名。尝试升级它以查看是否有帮助。

尝试将irb添加到Gemfile

The mentioned file has been deleted in this pr, and on the version irb 1.7.2.升级您的irb可能会解决您的问题。

gem 'irb', '~> 1.4'

字符串
bundle install
除了这个可以解决你的问题,它也会让你受益,因为irb在等待被包含在下一个ruby版本中时会得到定期的改进。

如果您仍然看到相同的错误

您可能需要在问题中添加这些细节

  • 您是否使用像~/.irbrc这样的配置文件
  • 你试过运行spring stop
  • 像github gist一样将你安装的gem链接成文本文件

相关问题