barlop
barlop

Reputation: 13780

In Windows, rails s gives 3 different errors, I fix one and get a bunch more

following a guide a friend sent me, I tried rails s.

I am getting these errors when running rails s

First i'll show the version of ruby and rails

C:\>ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]

C:\>rails -v
Rails 4.2.1

C:\>

and I run rails new qwerty that goes fine

C:\rubyblah>rails new qwerty
      create
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
         run  bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.6.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.1
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.5
Using activejob 4.2.1
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bundler 1.9.9
Using columnize 0.9.0
Using byebug 5.0.0
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.1
Using coffee-rails 4.1.0
Using multi_json 1.11.0
Using jbuilder 2.2.16
Using jquery-rails 4.0.3
Using sprockets 3.1.0
Using sprockets-rails 2.3.1
Using rails 4.2.1
Using rdoc 4.2.0
Using sass 3.4.14
Using tilt 1.4.1
Using sass-rails 5.0.3
Using sdoc 0.4.1
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using tzinfo-data 1.2015.4
Using uglifier 2.7.1
Using web-console 2.1.2
Bundle complete! 12 Gemfile dependencies, 54 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

--

then bundle install goes fine

C:\rubyblah>cd qwerty

C:\rubyblah\qwerty>bundle install
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.6.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.1
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.5
Using activejob 4.2.1
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using columnize 0.9.0
Using byebug 5.0.0
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.1
Using coffee-rails 4.1.0
Using multi_json 1.11.0
Using jbuilder 2.2.16
Using jquery-rails 4.0.3
Using bundler 1.9.9
Using sprockets 3.1.0
Using sprockets-rails 2.3.1
Using rails 4.2.1
Using rdoc 4.2.0
Using sass 3.4.14
Using tilt 1.4.1
Using sass-rails 5.0.3
Using sdoc 0.4.1
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using tzinfo-data 1.2015.4
Using uglifier 2.7.1
Using web-console 2.1.2
Bundle complete! 12 Gemfile dependencies, 54 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

--

then rails s, and I get these errors

C:\rubyblah\qwerty>rails s
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.rb
: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/l
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/l
ib/sqlite3.rb:2:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:76:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler.rb
:134:in `require'
        from C:/rubyblah/qwerty/config/application.rb:7:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/commands_tasks.rb:78:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/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/com
mands/commands_tasks.rb:75:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/commands_tasks.rb:75:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

C:\rubyblah\qwerty>

I found this regarding the first error

cannot load such file -- sqlite3/sqlite3_native (LoadError) on ruby on rails

So I edited the corresponding gemspec file as instructed

C:\>dir sql*.gemspec /s/b
C:\Ruby22-x64\lib\ruby\gems\2.2.0\specifications\sqlite3-1.3.10-x64-mingw32.gems
pec

I edit that gemspec file changing s.require_paths = ["lib"] to s.require_paths = ["lib/sqlite3_native"]

Then when I run rails s, I get a whole new bunch of errors

C:\rubyblah\qwerty>rails s
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri
.rb:29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32
/lib/nokogiri.rb:29:in `rescue in <top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32
/lib/nokogiri.rb:25:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3
:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3
:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/l
ib/rails-html-sanitizer.rb:2:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/l
ib/rails-html-sanitizer.rb:2:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/sanitize_helper.rb:3:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/sanitize_helper.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/text_helper.rb:32:in `<module:TextHelper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/text_helper.rb:29:in `<module:Helpers>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/text_helper.rb:6:in `<module:ActionView>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/text_helper.rb:4:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/form_tag_helper.rb:14:in `<module:Helpers>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/form_tag_helper.rb:6:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/form_helper.rb:4:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers/form_helper.rb:4:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers.rb:50:in `<module:Helpers>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers.rb:4:in `<module:ActionView>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_
view/helpers.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/legacy_asset_tag_helper.rb:7:in `<module:LegacyAssetTagHelper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/legacy_asset_tag_helper.rb:6:in `<module:Rails>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/legacy_asset_tag_helper.rb:4:in `<module:Sprockets>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/legacy_asset_tag_helper.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/helper.rb:54:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/helper.rb:54:in `<module:Helper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/helper.rb:7:in `<module:Rails>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/helper.rb:6:in `<module:Sprockets>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/rails/helper.rb:5:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/railtie.rb:6:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp
rockets/railtie.rb:6:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra
ils/railtie.rb:3:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra
ils/railtie.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra
ils.rb:11:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra
ils.rb:11:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass-ra
ils.rb:1:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass-ra
ils.rb:1:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:76:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru
ntime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler.rb
:134:in `require'
        from C:/rubyblah/qwerty/config/application.rb:7:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/commands_tasks.rb:78:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/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/com
mands/commands_tasks.rb:75:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/commands_tasks.rb:75:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com
mands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

C:\rubyblah\qwerty>

Upvotes: 1

Views: 614

Answers (2)

Azolo
Azolo

Reputation: 4383

It looks like the sqlite3 gem doesn't have a have a fat binary for Ruby 2.2 yet.

You can wait till one is published but gem authors usually only do fat binary builds on a gem release.

My recommendation is to downgrade to Ruby 2.1.6, at least until newer versions of those gems are released.

Upvotes: 0

barlop
barlop

Reputation: 13780

One option is downgrading ruby to a version that is stable/working with windows. The other option is installing a linux VM and installing Ruby there.

You need to install a version of Ruby that is stable with Windows.

Not the latest version of Ruby. As of writing the latest is 2.2.2 and not stable with Windows.

And even if you are on a 64bit machine, the stable Ruby for Windows is a 32bit.

You want Ruby 2.1.X e.g. Ruby 2.1.6 (the latest 2.1.x is fine, 2.1.6) And you want the 32bit version

http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.1.6.exe

That is mentioned here http://rubyinstaller.org/downloads/ "we recommend you use Ruby 2.1.X installers. These provide a stable language and a extensive list of packages (gems) that are compatible and updated.

However, not all packages (gems) are maintained. Some older packages may not be compatible with newer versions of Ruby and RubyInstaller.

The 64-bit versions of Ruby are relatively new on the Windows area and not all the packages have been updated to be compatible with it. To use this version you will require some knowledge about compilers and solving dependency issues, which might be too complicated if you just want to play with the language."

Take note of that instruction

So remove any current Ruby you have.

To remove Ruby, you go to the start menu..Ruby.. and click Uninstall.

That should uninstall Rails too.

And remove any devkit. The devkit executable installs by extraction to a folder you specify so just rmdir/remove that folder.

Now install that stable ruby.. 2.1.6 32bit Install rails and the devkit

The command to install rails

gem install rails

An to install the devkit make sure you have the correct one

e.g.

http://rubyinstaller.org/downloads/

WHICH DEVELOPMENT KIT?
....

Ruby 1.8.6 to 1.9.3: tdm-32-4.5.2  

Ruby 2.0.0 and above (32bits): mingw64-32-4.7.2  

Ruby 2.0.0 and above x64 (64bits): mingw64-64-4.7.2  

So you want

Ruby 2.0.0 and above (32bits): mingw64-32-4.7.2

Look at the available devkits

DEVELOPMENT KIT

For use with Ruby 1.8.7 and 1.9.3:

DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
For use with Ruby 2.0 and above (32bits version only):

DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
For use with Ruby 2.0 and above (x64 - 64bits only)

DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

You want

DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
For use with Ruby 2.0 and above (32bits version only):

http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

Follow the instructions from here to install devkit https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

So say you put it in c:\devkit

c:\devkit>ruby dk.rb init

c:\devkit>ruby dk.rb install

you can run this command though i don't think it's necessary c:\sdfsd>gem install json --platform=ruby

so now you have ruby and rails and the devkit installed

rails new <project name>

cd <project name>

bundle install

rails s

http://localhost:3000 (in your browser)

and it says 'welcome aboard'

Upvotes: 2

Related Questions