首页 > 解决方案 > 如何调试ruby-on-rails mac osx的升级

问题描述

需要帮助调试升级到 Ruby 和 Rails gem 以启动 web 服务并推送到 Heroku。

我尝试升级 Ruby 版本和 Rails,让我的 web 服务在我的 MAC v 10.14.4 上再次启动我的应用程序以满足 Heroku 要求:

“新应用程序的默认 Ruby 将比最新版本低一个小版本。例如,当 Ruby 2.6.0 发布时,Ruby 2.5.x 将成为 > 默认值。”

我不断收到此错误:

[!] 解析时出错Gemfile:不正确的需求 ["ruby 2.5.0"]。Bundler 无法继续。

# 来自 /Users/waf-mbp/Documents/Ruby/RoR/2100_Solution_blogs/Gemfile:2 # ----------------------------- -------------- # 来源' https://rubygems.org '

红宝石“红宝石 2.5.0”

无论 Gemfile 中显示的版本如何,我都需要帮助解决此错误。我需要将我的更新推送到 Heroku。

我正在使用 pg 为 Web 服务提供动力。

运行“rails s”后出现此错误:Bundler 找不到 gem“railties”的兼容版本:在快照中(Gemfile.lock):railties(= 5.2.0)

在 Gemfile 中:coffee-rails (~> 4.1.0) 被解析为 4.1.1,这取决于 railties (>= 4.0.0, < 5.1.x)

jquery-rails was resolved to 4.3.3, which depends on
  railties (>= 4.2.0)

rails (= 5.2.0) was resolved to 5.2.0, which depends on
  railties (= 5.2.0)

sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
  railties (>= 4.0.0, < 6)

运行bundle update将只使用 Gemfile 中的 gem 从头开始​​重建快照,这可能会解决冲突。

这是我的 Gemfile:

source 'https://rubygems.org'
ruby "ruby 2.5.0"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.2.3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'puma'

gem 'rake'

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

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

标签: ruby-on-rails-5

解决方案


你有一个小的语法错误Gemfile: ruby​​ 解释器的行应该只是

ruby "2.5.0"


推荐阅读