search_up:Ruby 升级后出现未定义方法“untaint”错误

问题描述 投票:0回答:3

这里是业余编码员。为了升级我的 Heroku 堆栈,我必须迁移到更高版本的 Ruby。我按照教程升级到 Ruby 3.2。

升级后,每当我尝试执行“rails s”或“bundle update”等任何操作时,都会收到以下错误。我在网上搜索了很多,但找不到太多用处。

有什么想法吗?

非常感谢您的任何提示

ec2-user:~/environment/website (master) $ bundle update

/home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:272:in `search_up': undefined method `untaint' for "/home/ec2-user/environment/website":String (NoMethodError)

  current  = File.expand_path(SharedHelpers.pwd).untaint
                                                ^^^^^^^^
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:259:in `find_file'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:251:in `find_gemfile'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:27:in `root'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler.rb:234:in `root'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler.rb:246:in `app_config_path'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler.rb:273:in `settings'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/feature_flag.rb:21:in `block in settings_method'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/cli.rb:97:in `<class:CLI>'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/cli.rb:7:in `<module:Bundler>'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/cli.rb:6:in `<top (required)>'
    from <internal:/home/ec2-user/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/3.2.0+1/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from <internal:/home/ec2-user/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/3.2.0+1/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/exe/bundle:23:in `block in <top (required)>'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/bundle:25:in `load'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/bundle:25:in `<main>'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/ruby_executable_hooks:22:in `eval'
    from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/ruby_executable_hooks:22:in `<main>'
ruby-on-rails ruby rubygems bundler
3个回答
50
投票

安装前请检查

Gemfile.lock
你应该先删除 Gemfile.lock 。 (因为,锁定文件取决于旧版本的ruby)


17
投票

Ruby 3.2.0 删除了一些已弃用的方法(taint/trust/untaint/untrust),参考:https://bugs.ruby-lang.org/issues/16131。 Bundler 版本 1.17.3 在 shared_helpers.rb 中有该方法。尝试将捆绑程序更新到 2.4.1 .


0
投票

试试这个 rm -f Gemfile.lock 捆绑

© www.soinside.com 2019 - 2024. All rights reserved.