Antonin Mrchd
Antonin Mrchd

Reputation: 199

Rails console doesn't work "You may have encountered a bug"

I search if the question had been already asked but I didn't find anything. I have create an application using ruby version 2.3.0 and rails version 5.0.0.1,

When I run this commande

rails console

And I try to access db like that :

Post.all
User.all

Or other command line I have this enormous error (sorry for all these lines :

/Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:27: [BUG] Segmentation fault at 0x00000000000110
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/CrashReporter                                         
     * /Library/Logs/CrashReporter                                          
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0061 p:---- s:0252 e:000251 CFUNC  :initialize
c:0060 p:---- s:0250 e:000249 CFUNC  :new
c:0059 p:0186 s:0245 e:000244 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:
c:0058 p:0028 s:0238 e:000237 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0057 p:0027 s:0235 e:000234 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0056 p:0025 s:0232 e:000231 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0055 p:0018 s:0227 e:000226 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0054 p:0016 s:0222 e:000220 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0053 p:0035 s:0217 e:000213 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0052 p:0046 s:0211 e:000210 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0051 p:0015 s:0205 e:000204 METHOD 

....... (other lines)

 1666 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder/range_handler.rb
 1667 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder/relation_handler.rb
 1668 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder.rb
 1669 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/table_metadata.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Upvotes: 3

Views: 19521

Answers (5)

Javier Claros
Javier Claros

Reputation: 349

If you are using Chip M1

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

Upvotes: 10

annon bytes
annon bytes

Reputation: 161

If you still run into issues, try the following steps:

  • Install webpacker using npm by running this command: npm i @rails/webpacker Run bundle install Note: You may need to eliminate the version designation. If so, do the following:

  • In your Gemfile: change the line with the webpacker gem into: gem webpacker

    Delete the gemfile.lock file
    Run bundle install
    
  • Manually add a file called webpacker.yml to the config directory (final path: ./config/webpacker.yml).

    Add this text to the webpacker.yml file:
    

development: dev_server: host: localhost port: 3000

Upvotes: 1

wangboguo
wangboguo

Reputation: 46

Input spring stop before rails c

or just remove gem spring in Gemfile.

Just try it!

Here you can find more about it:

https://github.com/sparklemotion/sqlite3-ruby/issues/195

https://github.com/rails/spring/issues/493

Upvotes: 2

dsn raghavendra rao
dsn raghavendra rao

Reputation: 196

try like this it workes for me

gem uninstall sqlite3
gem install sqlite3

Upvotes: 5

FAMMMM
FAMMMM

Reputation: 79

that's right ,edit Gemfile put

  gem 'sqlite3'

to

 group :development, :test do
    gem 'sqlite3'
 end

and

rails console

would be used for me! thanks!

Upvotes: 3

Related Questions