rails 4.2.0 console broken with 'file is already defined' - ruby-on-rails

Currently using rails 4.2.0 & ruby 2.2.0p0
re-bundled to pick up some gem updates
RAILS_ENV=production rails c fails with the following stack trace
/home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler/runtime.rb:76:in require': File is already defined (NameError)
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler/runtime.rb:76:inblock (2 levels) in require'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler/runtime.rb:72:in each'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler/runtime.rb:72:inblock in require'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler/runtime.rb:61:in each'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler/runtime.rb:61:inrequire'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.7.11/lib/bundler.rb:134:in require'
from /home/linkee/linker/config/application.rb:14:in'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:141:in require'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:141:inrequire_application_and_environment!'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:67:in console'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
from /home/linkee/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in <top (required)>'
from /home/linkee/linker/bin/rails:4:inrequire'
from /home/linkee/linker/bin/rails:4:in `'
I note that the runtime.rb fails when trying to require 'zipruby' so I excluded that gem from being required by changing line 76 in require.rb to
pp required_file = file
Kernel.require(file) unless file == 'zipruby'
and that at least bypassed whatever the problem was.
Please let me know if you require further information to help in sorting out this problem.

Related

Cannot load sqlite3_native.so when trying to rake assets:precompile

I'm following a tutorial of Ruby on rails from this website: https://rails-3-2.railstutorial.org/book/beginning#sec-heroku_setup
and I'm currently stuck at a part where it's telling me to run the command:
rake assets:precompile
It's giving me this error:
/home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/activesupport-3.2.16/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
rake aborted!
LoadError: incompatible library version - /home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.so
/home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/sqlite3-1.3.5/lib/sqlite3.rb:6:in require' /home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/sqlite3-1.3.5/lib/sqlite3.rb:6:in rescue in <top (required)>'
/home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/sqlite3-1.3.5/lib/sqlite3.rb:2:in <top (required)>' /home/myName/Desktop/rails_projects/first_app/config/application.rb:7:in <top (required)>'
/home/myName/Desktop/rails_projects/first_app/Rakefile:5:in <top (required)>' /home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/rake-12.2.1/exe/rake:27:in <top (required)>'
Caused by:
LoadError: cannot load such file -- sqlite3/2.3/sqlite3_native
/home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/sqlite3-1.3.5/lib/sqlite3.rb:4:in require' /home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/sqlite3-1.3.5/lib/sqlite3.rb:4:in <top (required)>'
/home/myName/Desktop/rails_projects/first_app/config/application.rb:7:in <top (required)>' /home/myName/Desktop/rails_projects/first_app/Rakefile:5:in <top (required)>'
/home/myName/.rvm/gems/ruby-1.9.3-p551#rails3tutorial2ndEd/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
From what I understand of it, I think my sqlite3 is corrupted since I made sure that sqlite3 is installed ("gem list" returns me a list of the gems installed and sqlite 1.3.5 is installed).
I therefor attempted to re-install sqlite3 1.3.5 but no luck in getting it to work. I'm confused on how to resolve the issue, any help is very much appreciated!
Thank you!
I somehow fixed it.
I'm not exactly sure why it worked but it seems like it worked after re-installing bundler.
gem uninstall bundler
gem install bundler

Ruby on Rails Error on Windows 10

How can I solve this problem? please, help.
I am using windows 10 and I am trying to run this already existing RoR project.I am very newbie to these projects. Here an error with stack:
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-3.2.6/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:17:in require': cannot load such file -- 2.2/http11 (LoadError)
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:17:inrescue in '
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:13:in <top (required)>'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:inrequire'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in block (2 levels) in require'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:ineach'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in block in require'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:ineach'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in require'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler.rb:106:inrequire'
from C:/bottomup_source/bottomup_source/config/application.rb:7:in <top (required)>'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-3.2.6/lib/rails/commands.rb:53:inrequire'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-3.2.6/lib/rails/commands.rb:53:in block in <top (required)>'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-3.2.6/lib/rails/commands.rb:50:intap'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-3.2.6/lib/rails/commands.rb:50:in <top (required)>'
from script/rails:6:inrequire'
from script/rails:6:in `'
i m using ruby on rails from last one year , i would recommend you to use linux or ubuntu for ruby on rails as most of the tools are not compatible with windows for development, but still if you want to use on windows os the follow this ruby on rails on window hopefully this will help you.

Ruby on Rails - after rails_s is entered

I am learning Ruby on Rails and still unfamilar with some of parts of the language.
I am trying to get a rails project to display on Firefox however as soon as I enter the command "rails s" I am presented with the following error:
Rails S Error
The source code is :
C:\Sites\weeks_1_-_15\week_1\bookshop1a>rails s
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.2/lib/act
ive_support/values/time_zone.rb:282: warning: circular argument reference - now
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw32/
lib/sqlite3.rb:6:in require': cannot load such file -- sqlite3/sqlite3_native (
LoadError)
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10
-x86-mingw32/lib/sqlite3.rb:6:inrescue in '
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10
-x86-mingw32/lib/sqlite3.rb:2:in <top (required)>'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:91:inrequire'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:91:in block (2 levels) in require'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:86:ineach'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:86:in block in require'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:75:ineach'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:75:in require'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler.rb:106:inrequire'
from C:/Sites/weeks_1_-_15/week_1/bookshop1a/config/application.rb:7:in
<top (required)>'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.0.2
/lib/rails/commands.rb:74:inrequire'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.0.2
/lib/rails/commands.rb:74:in block in <top (required)>'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.0.2
/lib/rails/commands.rb:71:intap'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.0.2
/lib/rails/commands.rb:71:in <top (required)>'
from script/rails:6:inrequire'
from script/rails:6:in `'
Any help would be much appreciated!
Thank you!
The error message indicates that SQLite is not installed or properly configured.
Try starting rails server after installing SQLite first.
Maybe this tutorial is helpful to get SQLite up and running:
http://www.sqlitetutorial.net/download-install-sqlite/

Ruby-Audio - "The specified module could not be found..."

I've installed the ruby-audio-1.6.1 gem and I've added it to my Gemfile for my rails project however when trying to start up the server I'm getting:
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/ruby-audio-1.6.1/lib/ruby-audio.rb:6:in
require': 126: The specified module could not be found.
- C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/ruby-audio-1.6.1/rubyaudio_ext.so
(LoadError)
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/ruby-audio-1.6.1/lib/ruby-audio.rb:6:in
rescue in '
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/ruby-audio-1.6.1/lib/ruby-audio.rb:1:in
<top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler/runtime.rb:76:in
require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler/runtime.rb:76:in
block (2 levels) in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler/runtime.rb:72:in
each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler/runtime.rb:72:in
block in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler/runtime.rb:61:in
each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler/runtime.rb:61:in
require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.8/lib/bundler.rb:134:in
require'
from E:/Development/mixer/config/application.rb:7:in <top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:79:in
require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:79:in
block inserver'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in
tap'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in
server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in
run_command!'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in
<top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in `'
I've been digging around and can't find much, I've ensured that libsndfile is installed correctly so the initial gem install went just fine, it's now just erroring out at this point. I've checked the file actually exists in that location and it does some I'm a bit stumped as to what could be going wrong.
In your Gemfile, try marking it as require false:
gem 'ruby-audio', require: false
Try starting the server, and post the results in your question.
You may also want to try a newer gem because the ruby-audio gem is quite old.
The sndfile gem is similar and newer: https://github.com/ronen/sndfile

can't run cucumber scenarios due to test-unit version issue on Rails 2.3.5, Ruby 1.9.1

I've been trying to follow along in the RSpec book, (I'm new to all of this) and I have what appears to be some kind of versioning issue. If I try and run some simple scenarios, I get this error:
can't activate test-unit (= 1.2.3, runtime) for [], already activated test-unit-2.0.7 for [] (Gem::LoadError)
/Users/jeffdeville/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems.rb:230:in activate'
/Users/jeffdeville/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems.rb:1056:ingem'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/rspec-1.3.0/lib/spec/interop/test.rb:4:in <top (required)>'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/rspec-1.3.0/lib/spec/test/unit.rb:1:in <top (required)>'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/rspec-rails-1.3.2/lib/spec/rails.rb:13:in <top (required)>'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-rails-0.3.0/lib/cucumber/rails/rspec.rb:15:in rescue in <top (required)>'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-rails-0.3.0/lib/cucumber/rails/rspec.rb:3:in'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in require'
/Users/jeffdeville/code/showtime/Features/support/env.rb:11:in'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.1/lib/polyglot.rb:64:inrequire'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/rb_support/rb_language.rb:124:in load_code_file'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:85:inload_code_file'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:77:in block in load_code_files'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:76:ineach'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:76:in load_code_files'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/cli/main.rb:48:inexecute!'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/lib/cucumber/cli/main.rb:20:in execute'
/Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.4/bin/cucumber:8:in'
script/cucumber:9:in load'
script/cucumber:9:in'
however, uninstalling 2.0.7 yields the error:
Missing these required gems:
test-unit = 2.0.7
You're running:
ruby 1.9.1.378 at /Users/jeffdeville/.rvm/rubies/ruby-1.9.1-p378/bin/ruby
rubygems 1.3.6 at /Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378, /Users/jeffdeville/.rvm/gems/ruby-1.9.1-p378#global
Run rake gems:install to install the missing gems.
Sorry this is probably something easy, but I just don't know ruby or rails well enough yet.

Resources