Problem creating Rails application

Asked

Viewed 210 times

2

Whenever I’m going to create an application, when doing a scaffold (following tutorials) I get the following error:

C:\Users\User\Usuarios>rails generate scaffold Usuario nome:string idade:integer
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/lib/sqlite3.rb:6:in `rescue in <top (requ
ired)>'
        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.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 requ
ire'
        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/Claudanilo/Usuarios/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:141:in `require'

        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:141:in `require_
application_and_environment!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:128:in `generate
_or_destroy'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:50:in `generate'

        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_comma
nd!'
        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>'

What is going wrong?

  • Apparently the problem is in sqlite3, has how you check if it is installed? (ps.:are sure you want to build Rails applications using Windows?)

  • Running Ruby applications on Windows is an arduous task, since the environment is a bit inhospitable to this platform. If you have the possibility, developing in a UNIX environment (a virtual machine running linux would be enough) often makes the experience much more smooth, avoiding a range of banal errors.

  • Specifically about your error: which version of Ruby are you using? What happens if you try to update the version of Gem sqlite (gem update sqlite3)?

  • Well, I’m running on Windows more for real learning, but I’m already considering migrating to linux (Ubuntu or centos). About the version: Ruby 2.2.2; Rails 4.2.1; About sqlite3: when I update appears "Nothing to Update";

  • Just updating, I give up trying to run windows. I did some tests here on a virtual machine of mine (running hundreds) and it was really much quieter. I thank those who tried to help :)

  • Is this the first scaffold of your application? Ever run a rake db:create ?

Show 1 more comment

1 answer

1

Friend if you still want to try Windows the solution is to install Ruby 2.0.0 and Rails again in this older version. I’m also studying on Windows and had the same problem, only mine was when running the command rake db:create to create the application database. The reason for this problem is that sqlite3 1.3.10 is not compatible (on Windows I believe) with Ruby 2.2.2.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.