ruby-on-rails-5 - 如何调试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
解决方案
你有一个小的语法错误Gemfile
: ruby 解释器的行应该只是
ruby "2.5.0"
推荐阅读
- powershell - powershell 中的 Compress-7zip 有时会创建无效的 zip 文件
- installation - 在控创 ETX LX2 板上安装 Windows 10 IoT Core (Computer-on-Module)
- python - 将 ndarray 从 Python 扩展返回到 C
- python - 如何选择使用哪个设备录制(Python PyAudio)
- sql - SQL中的多个正则表达式求和
- php - 使用 Zend Framework 绑定表单中的对象的问题
- angular - 如何在当前模块中使用其他模块的组件?
- sql - 有没有办法将数据帧的一列中的所有行与另一个数据帧的另一列(火花)中的所有行进行比较?
- javascript - 如何创建 Javascript 真假测验
- google-fit - 使用 REST API 添加的 Google Fit 数据在 Android 上的 Google Fit 应用中不可见