我无法在heroku上推送我的rails应用程序。以下是我尝试在heroku上推送rails应用程序时收到的错误消息。
检测到Ruby应用程序编译Ruby / Rails sh:1:Gemfile:找不到! ! 解析你的Gemfile时出错,我们无法继续! ! [!]解析
Gemfile
时出错:语法错误,意外 ':',期待输入结束 - 组:生产做! ^。捆绑 无法继续。 ! !来自 / tmp / build_c114d933dd903e377866500bea22e827 / Gemfile:50! # -------------------------------------------! #! >组:生产做! #gem'pg'! # -------------------------------------------! !推送拒绝,无法编译Ruby应用程序。
这就是我的gemfile的样子。
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use sqlite3 as the database for Active Record
# 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
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
gem 'sqlite3'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group: production do
gem 'pg'
gem 'rails_12factor'
end
答案 0 :(得分:0)
好的我明白了。由于您在gem文件中犯了两个错误,您收到此错误
(1)您忘记在gem文件中定义gem 'byebug'
的版本。
(2)您写了group: production do
,假设是group :production do
我很确定您无法在本地运行您的应用,直到您解决这两个问题。
在您的gem文件中添加gem 'byebug', '3.4.0'
。如果您只是在{gem}文件底部的第4行添加gem 'byebug'
而不是'3.4.0'
,那么您只有group :production do
一旦您将这些更改添加到您的gem文件,请确保您运行group: production do
然后bundle install
成功完成上述过程后,您可以运行以下命令将您的应用程序上传到heroku。
bundle update
答案 1 :(得分:0)
这是解析Gemfile的错误:语法错误,意外&#39;:&#39;,期待输入结束 - 组:生产
如上所述...这只是语法错误
group: production do
gem 'pg'
gem 'rails_12factor'
end
从
更新group :production do
gem 'pg'
gem 'rails_12factor'
end