Error with rails s - ruby-on-rails

So when I try to fire up my server using rails s I get
/usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/sqlite3-1.3.8/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /Users/idrisk/rails_projects/first_app/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/railties-4.0.5/lib/rails/commands.rb:74:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/railties-4.0.5/lib/rails/commands.rb:74:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/railties-4.0.5/lib/rails/commands.rb:71:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/railties-4.0.5/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I've tried using sudo also, but then I get
/usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bundler-1.6.2, bundler-unload-1.0.2, executable-hooks-1.3.1, gem-wrappers-1.2.4, rubygems-bundler-1.4.3, rvm-1.11.3.9] (Gem::LoadError)
from /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:256:in `to_spec'
from /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems.rb:1231:in `gem'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/bin/rails:18:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `<main>'
I'm not really sure what this means. I've tried restarting and things in that sort of nature. But nothing seemed to work. Ideas?

Try updating Ruby and Rails with RVM - RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
Here is the website: https://rvm.io/

Related

rails server error on ubuntu

I am following ruby on rails getting started guide ( http://guides.rubyonrails.org/getting_started.html )
I installed ruby and rails as it is suggested in the guide but when I try to execute:
bin/rails server
I see the following error in the terminal:
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/soroosh/rails/blog/config/application.rb:7:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:78:in `require'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
from /home/soroosh/rails/blog/bin/rails:9:in `require'
from /home/soroosh/rails/blog/bin/rails:9:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client/rails.rb:28:in `load'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client/rails.rb:28:in `call'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client.rb:28:in `run'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/bin/spring:49:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/binstub.rb:11:in `load'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/soroosh/rails/blog/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
I am using ubuntu 15.10 , ruby 2.1 and rails4.2.5.1
If you look closely at the error message, this is the important line:
There was an error while trying to load the gem 'uglifier'.
Uglifier is a Javascript wrapper, so it will need a Javascript interpreter. I recommend installing NodeJS:
sudo apt-get install nodejs
read more about uglifier: https://github.com/lautis/uglifier

Cannot start WEBrick server. Mysql2 `require': cannot load such file

I have installed a fresh install of Ruby / Rails on an clean Windows 8 install and amy getting errors when trying to start the WEBrick server. Have searched for an answer but cant find one.
Error as below:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
from C:/Users/Brendon/Sites/quote/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Any help greatly appreciated
You need to use bundler to install the gem first.
Either do:
gem install mysql2
or
cd /my/rails/project && bundle install
note: the mysql2 gem is a [expletive] to install... best of luck

Active_support/dependencies.rb:247 `require': cannot load such file -- 2.1/pg_ext (LoadError)

I'm using Ruby 2.1.5, Rails 4.1.6 and PostgreSQL 9.3.5 on a Windows machine.
When I try to bundle exec rails server, I end up with the following error:
DL is deprecated, please use Fiddle
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- 2.1/pg_ext (LoadError)
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in re...re'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependancy'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1-x86-mingw32/lib/pg.rb:10:in `rescue in <top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1-x86-mingw32/lib/pg.rb:3:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `each'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `block in require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `each'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler.rb:133:in `require'
from C:/....../config/application.rb:5:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:79:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:79:in `block in server
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `tap'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `server'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
I needed to use a newer version of pg gem:
gem 'pg', '~> 0.18.0.pre20141117110243'
After updating, sometimes happens.
Try remove all gems and install all again. like
rm -rf ./vendor/bundle
bundle install

When I try to run commands in rails, I keep getting an error (bundle install, rails server, etc)

This is the error log that the command line shows when I run the bundler and Rails commands:
Users/MeksProper1/Desktop/kickthelistmaster/config/application.rb:7:in `<top (required)>': uninitialized constant Bundler (NameError)
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from bin/rails:4:in `<main>'
Mekatron:kickthelistmaster MeksProper1$ rails server
/Users/MeksProper1/Desktop/kickthelistmaster/config/application.rb:7:in `<top (required)>': uninitialized constant Bundler (NameError)
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from bin/rails:4:in `<main>'
It seems like you might not have Bundler installed correctly or if you do, maybe an earlier version. I would try
gem install bundler
Looks like you haven't install bundler. Try this:
gem install bundler

LoadError causing Server not to start

Can anybody explain this for me?
$ rails s
c:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7-x86-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from C:/Users/Sam/Documents/Aptana Studio 3 Workspace/First With Book/config/application.rb:7:in `<top (required)>'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from c:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Its my first rails program and I was following a rails tutorial which changed the gemfile but it hasn't worked, I guess I haven't installed something, I'm running gems 2.0.3 and rails 4.0.0 and with ruby I get this:
$ ruby -v
ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
From here
download the required executable and the dll from http://www.sqlite.org/download.html extract to your ruby's bin (c:\Ruby200\bin)

Resources