![](/img/trans.png)
[英]How to fix 'Your Ruby version is 2.3.3, but your Gemfile specified 2.5.2'
[英]How to fix “Your Ruby version is 2.3.3, but your Gemfile specified 2.7.1” when i use bundle install
当我执行“捆绑安装”时,会发生这种情况:您的 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-version' 以匹配您所拥有的 (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 时,您可以毫无问题地开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.