Gemfile:22: syntax error, unexpected tIDENTIFIER, expecting end-of-input - ruby-on-rails

When I run bundle install against the gemfile source below, I get a gemfile syntax error that points to the 'better errors' gem which is the second to last line.
When I run ruby -c Gemfile. I get the following message
Gemfile:22: syntax error, unexpected tIDENTIFIER, expecting end-of-input
gem 'better_errors'
Any ideas?
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
# learn-rails
gem 'activerecord-tableless'
gem 'bootstrap-sass'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form', '>= 3.0.0.r
group :development do
gem 'better_errors'
gem 'quiet_assets'
end 
Thank you for any assistance and time.

You missed the closing ' here :
gem 'simple_form', '>= 3.0.0.r <~~~
group :development do
gem 'better_errors'
gem 'quiet_assets'
end
Corrected
gem 'simple_form', '>= 3.0.0.r'
group :development do
gem 'better_errors'
gem 'quiet_assets'
end

After your version number specification for gem "simple_form":
">= 3.0.0.r\ngroup :development do\n gem "
(which is already invalid), you cannot continue another token better_errors without having a comma (which would be invalid anyway).

Related

Deploying Rails App with webpack to heroku

I created my rails with this template that included webpack. But i still wrote my javascript code in app/assets/javascript. Now I am trying to deploy my app to heroku and it keeps failing. I get this error
remote: /tmp/build_6f0656280cbbda40c5832ccb79fc1783/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:432:in `block in replace_bin_path': can't find executable webpack for gem webpacker (Gem::Exception)
The main error seems to be "cant find executable webpack for gem webpacker". I have no idea how to solve it. This is my gemfile
source 'https://rubygems.org'
ruby '2.3.5'
gem 'figaro'
gem 'jbuilder', '~> 2.0'
gem 'puma'
gem 'rails', '5.1.4'
gem 'redis'
gem 'cloudinary'
gem 'carrierwave', '~> 1.2'
gem 'rails_admin', '~> 1.2'
group :production do
gem 'pg', '~> 0.20'
end
gem 'autoprefixer-rails'
gem 'bootstrap-sass'
gem 'jquery-rails'
gem 'font-awesome-sass'
gem 'sass-rails'
gem 'simple_form'
gem 'turbolinks', '~> 5.0.0'
gem 'coffee-rails'
gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'ransack'
gem 'trix'
gem "letter_opener", group: :development
group :development do
gem 'web-console', '>= 3.3.0'
gem 'sqlite3'
end
group :development, :test do
# gem 'binding_of_caller'
# gem 'better_errors'
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
Breaking changes in 3.3.0
https://github.com/rails/webpacker/blob/master/CHANGELOG.md#330---2018-03-03
bundle exec rails webpacker:binstubs

learn-rails bundle install error parsing Gemfile

I'm totally noob, and doing the Learn Ruby On Rails Book One from start. I've got stuck a couple of times, but have resolved it myself by google, stackoverflow, etc... (I don't want to be a burden) But this I can't get by.
I'm on the Gemfile "chapter". First I just tried to copy the exact as it is in the book:
source 'https://rubygems.org' ruby '2.0.0'
gem 'rails', '4.0.1'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0' gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0' gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors' gem 'quiet_assets' gem 'rails_layout'
end
Which gives me this result:
[!] There was an error parsing `Gemfile`: syntax error, unexpected tIDENTIFIER, expecting gem 'rails', '4.0.1'...https://rubygems.org' ruby '2.0.0'
... ^. Bundler cannot continue.
# from /Users/MYUSERNAME/Projects/learn-rails/Gemfile:1
# -------------------------------------------
end 'better_errors' gem 'quiet_assets' gem 'rails_layout'
I then tried to change a few things like versions and so on, like this:
source 'https://rubygems.org'
ruby ’2.3.3’
gem 'rails', ’5.0.1’
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 5.0’
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2’
gem 'jquery-rails'
gem 'turbolinks’
gem 'jbuilder', '~> 2.5’
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors'
gem 'quiet_assets'
gem 'rails_layout'
end
This gives me this result:
[!] There was an error parsing `Gemfile`: no .<digit> floating literal anymore; put 0 before dot - ruby ’2.3.3’
^
/Users/MYUSERNAME/Projects/learn-rails/Gemfile:2: syntax error, unexpected tFLOAT, expecting '('
ruby ’2.3.3’
^. Bundler cannot continue.
# from /Users/MYUSERNAME/Projects/learn-rails/Gemfile:2
# -------------------------------------------
# source 'https://rubygems.org'
> ruby ’2.3.3’
# gem 'rails', ’5.0.1’
# -------------------------------------------
I've tried a few things I found when searching, like changing the ' to " on the ruby version, putting a '0.2.3.3' or just '.2.3.3', doing a bundle update, etc. I don't know what the the "no . floatin..." means? Or what the "expecting '('" is?
I really have searched and tried various solutions (got like 4-5 different saved "Gemfile" from trying whatever I found on the net).
Sorry if this just takes up space in the interwebs, but I just don't get it. If the original (from the book) doesn't even work, then why is it even there?
(I only changed my personal name to MYUSERNAME here, because it's my full, actual name, and maybe I'm paranoid but may so be. So that is not a fault)
Thanks,
Ethonrails
Make sure you use ' not ’ it's a different kind of apostrophe. (Everywhere in your Gemfile, I see a couple of instances ruby ’2.3.3’, gem 'sass-rails', '~> 5.0’)
Here is a version of your Gemfile that works:
source 'https://rubygems.org'
ruby '2.3.3'
gem 'rails', '5.0.1'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.5'
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors'
# gem 'quiet_assets' (not compatible with rails 5 atm)
gem 'rails_layout'
end
Tip: Try to use a code editor with syntax highlighting for Ruby, that should make future syntax errors easier to spot.
Try to replace ` characters to '
Instead of back quote (`), use single quote (') in your Gemfile.
As you are learning ruby on rails, I would like to suggest this link which may be useful to you, http://guides.rubyonrails.org/getting_started.html

Ruby version 2.2.5 but your Gem file specified 2.1.2

I already tried to update gem bundle and also try to pick gem 2.1.2 but ruby is not supporting them. Here is the error message:
error message
Gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.2.4'
gem 'pry-rails'
gem 'pg'
gem 'bcrypt', require: 'bcrypt'
gem 'friendly_id'
gem 'sass-rails', '~> 5.0'
gem 'bootstrap-sass'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'puma'
gem 'rails_12factor', group: :production
gem 'newrelic_rpm'
gem 'rack-timeout'
gem 'rmagick'
gem 'aws-sdk'
gem 'paperclip'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'binding_of_caller'
gem 'better_errors'
gem 'annotate'
gem 'dotenv-rails'
gem 'spring'
end
It seems that you have defined the ruby version for your project in the Gemfile. If you comment it out then, your app could use the system version of Ruby. If you need further help please publish the code in Gemfile.

Issue with Rails Bundle Install

When I try to run bundle install in terminal. I receive this error message.
Gemfile syntax error on line 36: syntax error, unexpected tIDENTIFIER, expecting
keyword_end
The code in my gem file is below. I am trying to install rspec, it works perfectly fine without the last 9 lines. So the problem lies somewhere in that section, yet I'm not able to figure it out. Any guidance would be much appreciated!
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/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
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0'
end
group :test do
gem 'rspec', '2.0.0' gem 'webrat', '0.7.1'
end
on line 36 you have this:
group :test do
gem 'rspec', '2.0.0' gem 'webrat', '0.7.1'
end
but you should have this (you need a new line)
group :test do
gem 'rspec', '2.0.0'
gem 'webrat', '0.7.1'
end
each gem has to be on its own line

Gemfile syntax error: when trying bundle install

source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass', '~> 3.0.3.0'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :doc do
gem 'sdoc', require: false
end
// When I try to bundle install --without production I get an error message.
This line looks a bit wrong gem 'bootstrap-sass', '~> 3.0.3.0'
Usually you would expect the semantic versioning to go to three levels only
I suspect the problem isn't being picked up when bundling locally.
The bundle install command installs the gems based on the Gemfile.lock file in your project. Try running a bundle update instead - this may resolve any version conflicts you may be having in your Gemfile (depending on if you've made any updates).

Resources