使用捆绑安装时如何修复"Your Ruby version is 2.3.3, but your Gemfile specified 2.7.1"



当我执行"捆绑安装";发生这种情况:您的Ruby版本是2.3.3,但您的Gemfile指定了2.7.1我能做什么?我正在使用我的电脑、Git Bash和Visual Studio

此处错误

我的Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.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'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
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', '>= 3.3.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

我没有做任何改变

您需要在机器上安装ruby 2.7.1版本才能继续。

或者,您可以更改Gemfile中指定的"ruby版本"以匹配现有版本(2.3.3(。这是一个相当大的更改,项目可能无法使用这样的旧版本。

您正在使用ruby版本管理器吗?这个Gemfile是从哪里来的?

如果这是因为您使用rails new启动了一个新的rails项目,那么您很可能希望使用比2.3.3更现代的ruby版本运行,这意味着(正如我在第一行中所说(,您需要升级系统的默认ruby。

我认为您可以遵循本教程https://medium.com/ruby-on-rails-web-application-development/how-to-install-rubyonrails-on-windows-7-8-10-complete-tutorial-2017-fc95720ee059,当你得到ruby 2.7.1时,你可以毫无问题地开始。

相关内容

  • 没有找到相关文章

最新更新