如何调试ruby-on-rails Mac OSX的升级

时间:2019-05-11 20:36:59

标签: ruby-on-rails-5

需要帮助调试升级到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“]。捆绑器无法继续。

     

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

     
    

红宝石“红宝石2.5.0”

  

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

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

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

在Gemfile中:     coffee-rails(〜> 4.1.0)已解析为4.1.1,具体取决于       栏(> = 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中的宝石,可以解决冲突。

这是我的宝石文件:

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

1 个答案:

答案 0 :(得分:0)

Gemfile中有一个小的语法错误:红宝石解释器的行应该简单地是

ruby "2.5.0"