Ruby On Rails server initiation errors - ruby-on-rails-3

I have been following the tutorial on how to learn Ruby On Rails basics. I have installed the latest 2.2.3 version and ran "gem install rails". I have successfully created a new project, but I have got an error when tried to run a server with "rails server" command. I received these errors:
C:\Users\Kothas\Desktop\rubyonrails\myproject>rails server
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.r:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/ib/sqlite3.rb:6:in `rescue in <top (required)>'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:76:in `require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:76:in `block (2 levels) in require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:72:in `each'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:72:in `block in require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:61:in `each'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:61:in `require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.
b:134:in `require'
from C:/Users/Kothas/Desktop/rubyonrails/myproject/config/application.r
:7:in `<top (required)>'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:78:in `require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:78:in `block in server'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:75:in `tap'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:75:in `server'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:39:in `run_command!'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How can I fix these problems and start my application?
EDIT
I managed to fix sqlite3 errors, but the new ones showed
"cannot load such file -- nokogirl (LoadError)"

It looks like your application is having difficulty accessing your sqlite installation through the sqlite3 gem - try this answer: cannot load such file -- sqlite3/sqlite3_native (LoadError) on ruby on rails

Related

Can't start rails server after aws-sdk-3 installed

I know that there is a lot of such kind of questions, but still, I believe my case is slightly different.
I recently decided to build in an AWS-S3 gem to my rails version 3 project (RUBY_VERSION - 1.9.2p320).
After the successfully aws-sdk gem have been installed, I've got an error message on rails server
/root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-core-3.78.0/lib/seahorse/client/net_http/patches.rb:26:in `alias_method': undefined method `new_transport_request' for class `Net::HTTP' (NameError)
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-core-3.78.0/lib/seahorse/client/net_http/patches.rb:26:in `apply!'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-core-3.78.0/lib/seahorse/client/net_http/connection_pool.rb:10:in `<top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-core-3.78.0/lib/seahorse.rb:34:in `require_relative'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-core-3.78.0/lib/seahorse.rb:34:in `<top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `block in require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:597:in `new_constants_in'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:225:in `load_dependency'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-core-3.78.0/lib/aws-sdk-core.rb:2:in `<top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `block in require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:597:in `new_constants_in'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:225:in `load_dependency'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-resources-3.59.0/lib/aws-sdk-resources.rb:1:in `<top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `block in require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:597:in `new_constants_in'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:225:in `load_dependency'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/activesupport-3.0.19/lib/active_support/dependencies.rb:242:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/aws-sdk-3.0.1/lib/aws-sdk.rb:1:in `<top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
from /jasa/api/trunk/config/application.rb:7:in `<top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/railties-3.0.19/lib/rails/commands.rb:28:in `require'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/railties-3.0.19/lib/rails/commands.rb:28:in `block in <top (required)>'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/railties-3.0.19/lib/rails/commands.rb:27:in `tap'
from /root/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/railties-3.0.19/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've tried both
gem 'aws-sdk', '~> 3'
and
gem 'aws-sdk-s3', '~> 1'
I've checked the referred module in github, but got hothing to catch on.
What am I doing wrong?
Thanks a lot. Any help will be appreciated.
I think it's clear based on referred module that you posted in your question. If you see the code new_transport_request method is defined in module Ruby_2 (line 30) and module Ruby_1_9_3 (line 83) and then if you see line 19 to 24 :
if RUBY_VERSION >= '2.0'
Net::HTTP.send(:include, Ruby_2)
Net::HTTP::IDEMPOTENT_METHODS_.clear
elsif RUBY_VERSION >= '1.9.3'
Net::HTTP.send(:include, Ruby_1_9_3)
end
there is no if condition for ruby 1.9.2. In conclusion the issue is not coming from Ruby or Rails but from the gem that does not support ruby 1.9.2.
You might just need to upgrade the ruby to 1.9.3 and it should fix this issue. Furthermore ruby 1.9.2 is no longer maintained so it's good idea to upgrade to avoid security vulnerability. I hope it's help.
Thank you.
I'd start with an update to the latest rails, but incrementally, of course. ActiveStorage feature changes and the latest gem. No telling what went south since Rails 3

LoadError: cannot load such file -- test/unit/error

I am trying to install insoshi in Rails 3.2.21 with ruby 1.9.3 every thing gone good but now I am stopped with an error when I try $rake gems:install it gives an error
rake aborted!
LoadError: cannot load such file -- test/unit/error
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/deprecation.rb:22
4:in `<top (required)>'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support.rb:37:in `<top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/misc.rake:11:in `<top (required
)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `load'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `block in <top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `each'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `<top (required)>
'
C:/Sites/insoshi/Rakefile:10:in `<top (required)>'
(See full trace by running task with --trace)
I am totally new with rails. hope for help
Try adding following gem into your gem file
gem 'test-unit'
Hope it will solve your problem.

PostgreSQL installation with existing Ruby on Rails app

I am on Mac OSX lion and am new to Ruby on Rails programming, so bear with me.
I'm trying to work on a teammates' Ruby on Rails app, but it requires that I have PostgreSQL installed. I installed it with Postgres.app (version 9.2.2). However, when I run rails server, I get the following error.
/Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib (LoadError)
Referenced from: /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle
Reason: image not found - /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg.rb:4:in `<top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/kevin/Documents/photowhoa/config/application.rb:13:in `<top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:53:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've already tried uninstalling and reinstalling the PG gem. If anyone can help me, that would be extremely appreciated.
Same problem. Rake can't find Postgres library.
This fixes the problem:
export DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.2/lib
Adjust path to lib to match yours.

MySQL2 error with RubyMine

This is the error message:
/Users/JasonJiang/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/JasonJiang/RubymineProjects/untitled6/script/rails server -b 0.0.0.0 -p 3000 -e development
/Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2.rb:9:in `require': dlopen(/Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2.rb:9:in `<top (required)>'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:68:in `require'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:66:in `each'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:66:in `block in require'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `each'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `require'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler.rb:128:in `require'
from /Users/JasonJiang/RubymineProjects/untitled6/config/application.rb:7:in `<top (required)>'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:52:in `require'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:52:in `block in <top (required)>'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
from /Users/JasonJiang/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `<top (required)>'
from /Users/JasonJiang/RubymineProjects/untitled6/script/rails:6:in `require'
from /Users/JasonJiang/RubymineProjects/untitled6/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Thanks all!
I solved this by opening up my project in the terminal using the /usr/local/bin/mine command. e.g.
mine .
For some reason, RubyMine isn't using the same environment one uses when just running 'rake test' from the command line (even though it uses the right .rvm version).

refinery-edge gives error "no such file to load -- refinerycms-base (LoadError)"

I'm trying to run refinery-edge on my Ubuntu 10.04 64bit. I have RVM installed, created the gemset "refinery-edge", and followed the steps in the refinery website, but when I try to create the refinery project I get the following error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- refinerycms-base (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinerycms.rb:2:in `block in <top (required)>'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinerycms.rb:1:in `each'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinerycms.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinery.rb:3:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from refinerycms-edge/bin/refinerycms:15:in `<main>'
Any help on this? thanks.
I've removed the guide as that was really for pre-0.9.9 and was asking for feedback via GitHub, please use the gem instead.
Currently the gem is up to date with edge.
Thanks