您尝试安装的 Ruby 版本不存在:ruby-2.6.1

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

在heroku中我得到了这个错误

The Ruby version you are trying to install does not exist: ruby-2.6.1

但是当我在本地放置 ruby -v 时,我得到了这个

ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin20]

当我做 gem update bundler 时,我收到了这个错误

Updating installed gems
Updating bundler
ERROR:  Error installing bundler:
    bundler-2.5.6 requires Ruby version >= 3.0.0. The current ruby version is 2.6.1.
Nothing to update
Gems already up-to-date: bundler

在 gemfile 中

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "2.6.1"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3', '>= 6.1.3.2'
# Use sqlite3 as the database for Active Record
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
group :production do
  gem 'pg'
end
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 4.1.0'
  # Display performance information such as SQL time and flame graphs for each request in your browser.
  # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
  gem 'rack-mini-profiler', '~> 2.0'
  gem 'listen', '~> 3.3'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
  gem 'rails_12factor'
end
gem 'nokogiri', '~> 1.10', '>= 1.10.3'
gem 'bootsnap'

gem 'mail_form'
gem "recaptcha", require: "recaptcha/rails"
ruby-on-rails ruby heroku
1个回答
0
投票

MacOS 附带了一个极其过时的 Ruby 版本,它位于默认的

PATH
中,可以在
/usr/bin
中找到。要使用较新的版本,您需要安装它。您可以从源代码执行此操作,使用 homebrew,或使用版本管理器,例如 rvm、rbenv 或 mise(所有这些都可以直接安装或使用 homebrew 安装)。根据您所做的选择,您可能还需要更新您的 zsh/bash 配置文件以更新
PATH
,以便在系统文件之前找到您的本地安装。如果您有多个安装,您可以通过键入
which -a ruby
检查发生的顺序。

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