I am following the Hartl Ruby on Rails tutorial, and am in section 1.2.4 of the tutorial
When setting up a Rails app it says to run these commands:
cd first_app_direcory
sublime Gemfile
bundle update
The sublime Gemfile command edits the Gemfile obviously, but when I try to run the command bundle update I get the following error:
bundle update
Gemfile syntax error:
ruby 2.0.0
^
/home/cameron/ruby/ror/first_app/Gemfile:2:
syntax error, unexpected tINTEGER,
expecting '('
ruby 2.0.0
^
I took these two lines out of the gemfile, even though it says to include them. Also, I tried Ruby 1.9.3, and still got the same error message.
ruby 2.0.0
#ruby-gemset=railstutorial_rails_4_0
After taking these lines out, it worked. I am trying to get it to work with those lines in the gemfile though. How can I do this?
This is the full Gemfile:
source 'https://rubygems.org'
ruby 2.0.0
#ruby-gemset=railstutorial_rails_4_0
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
group :developent do
gem 'sqlite3', '1.3.7'
end
# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'
# 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', '2.2.1'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.3.20',require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
You should have
ruby '2.0.0'
instead of
ruby 2.0.0
in your Gemfile.
I think you need quotes around the 2.0.0.
Something like ruby "2.0.0".
Related
I am trying to run a Ruby on Rails app on Cloud 9 with the following command:
rails s -p $PORT -b $IP
and I'm getting an error that tells me I don't have sqlite3 in the gem file when I do. This only happened after I pushed my code to Heroku and now it doesn't run in the console any more.
I already tried 'bundle install' and 'bundle update', I also tried to manually install sqlite3 by running 'gem install sqlite3', none of these solved my problem. I also started going through all the steps all over again to see if that issue pops up again, and it does.
source 'https://rubygems.org'
ruby '2.4.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# 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 Haml as the templating library
gem 'haml'
# 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
gem 'themoviedb'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'guard-rspec'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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', '~> 0.21' # for Heroku deployment
gem 'rails_12factor'
end
(Posted on behalf of the question author).
I fixed it eventually, what happened was the version in Gemfile.lock was 'sqlite3 (1.4.0)' but the version I needed was 'sqlite3 (1.3.13)'. I changed the version and ran 'rake db:migrate' and 'rake db:seed' again and now it's working.
Your app is probably running the production environment on Heroku, but your Gemfile only includes sqlite3 in the development & test groups. Move sqlite3 out of the groups so that it is available in all environments and redeploy.
Something wrong with sqlite3 versions > 1.4.0 with Rails 5. Mention sqlite3 version explicitly in Gemfile with v1.3.11 or v1.3.13.
(gem 'sqlite3', '~> 1.3.11')
I'm trying deploy a GAE project for the first time, after successfully publishing one of the test apps, and i'm getting an error regarding a wrong ruby version. I'm not sure if it's one of the other gems, but i'm not familiar with ROR or GCS, and i'm not sure what else to do.
Thanks.
Here are some of my system settings:
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin14]
$ rvm list
rvm rubies
* ruby-2.4.0 [ x86_64 ]
=> ruby-2.4.1 [ x86_64 ]
$ rails -v
Rails 5.0.2
Gem file:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.2'
ruby "2.4.1"
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 5.0.0.beta1'
# 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'
gem 'coffee-rails', '~> 4.2.1'
# 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', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production do
gem "mysql2", "~> 0.3.0"
end
group :development, :test do
gem "sqlite3"
end
gem "rack"
gem "puma"
The default interpreter is currently Ruby 2.3.3. You can specify a different Ruby version by writing the version name to a .ruby-version file in your application directory. For example:
2.2.5
When a .ruby-version file is present, the runtime attempts to download and install the specified version of Ruby. If the version cannot be satisfied, you will receive an error message when deploying your application.
Docs: https://cloud.google.com/appengine/docs/flexible/ruby/runtime
So Solidus is a fork of Spree and Spree is no longer maintained.
Am following the instructions on the Solidus's Github page (https://github.com/solidusio/solidus) to install it. And am stuck at this command bundle exec rails g spree:install this command raises the following error:
/Users/user1/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/handlebars_assets-0.19.1/lib/handlebars_assets.rb:20:in 'block in register_extensions': undefined method 'register_engine' for nil:NilClass (NoMethodError)
Not sure if this might help but before trying to install Solidus I was working on a Spree project.
Also, here is my Gemfile:
source 'https://rubygems.org'
# Solidus E-Commerce
gem 'solidus'
gem 'solidus_auth_devise'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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
# 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
Any help is really appreciated.
Update:
This is a known bug with handlebars-assets gem, which is resolved in master.
Adding the line :
gem 'handlebars_assets', github: 'leshill/handlebars_assets'
to your Gemfile will solve your problem until a new version contains the relevant fix.
Move the lines :
gem 'solidus'
gem 'solidus_auth_devise'
below gem 'rails', '4.2.4' because the former depends on the latter.
We've released a new version of solidus (v1.1.1) which locks sprockets-rails to 2.x to fix this issue.
https://github.com/solidusio/solidus/releases/tag/v1.1.1
In lieu of upgrading you can also specify the older sprockets-rails version in your Gemfile
gem "sprockets-rails", "~> 2.3"
I've looked on as many existing answers as I can, but I can't figure out why heroku is still trying to install sqlite3. Below is my gemfile, I don't even have sqlite3 on it anymore, as I am using mysql in development, test, and production. What am I missing? I don't see any dependencies either?
I get the error Detected sqlite3 gem which is not supported on Heroku when trying to push.
gemfile
source 'https://rubygems.org'
gem 'thin'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
#mysql
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# 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', '~> 1.2'
#tagging
gem 'acts-as-taggable-on'
#debugger
gem 'debugger'
#backup db with yaml_db
gem 'yaml_db', github: 'jetthoughts/yaml_db', ref: 'fb4b6bd7e12de3cffa93e0a298a1e5253d7e92ba'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
As mentioned in the comments, you've probably not rebuilt your Gemfile.lock. The way to do this is to run bundle install on your development system (rebuilds Gemfile.lock) and then push to Heroku again:
$ bundle install
$ git add .
$ git commit -a -m "SQLite3"
$ git push heroku master
I recently installed linux and am trying my hand at ruby development. I have successfully installed rvm, along with rails and sqlite3. I created a test application in Aptana RadRails to make sure my install worked correctly.
Unfortunately, when I try to run my app I receive this error:
/home/Daniel/Workspace/Dan_Test/Gemfile:1:in <main>': undefined
methodsource' for main:Object (NoMethodError)
I cannot figure out why I am receiving this error. The application is the default created under 'rails new'; I have added no new code. I have also run bundle install so the appropriate gems should be present.
Thank you very much for your help!
below is the gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# 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', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Forgive me; the issue was with how I installed rvm. I set a path that didn't exist in the bashrc: source /etc/provile.d/rvm.sh, instead of /etc/profile.d/rvm.sh. This seems to have caused the majority of my issues.
Thank you for your patience!