First Rails Application


#1

Hey guys im currently at the part where i need to generate a template using:

rails generate scaffold car make:string model:string year:integer

but its resulting in error. i have already tried to open the gemfile in VScode using:

code Gemfile.

but the file opening in VScode is blank. ive tried to go back a few steps and reinstall rails and continue on from there but its been resulting in the same error… This is the error ive been getting.
Thanks in advance,

/home/kutta/.rbenv/versions/2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile. (LoadError)
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:12:in `<main>'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:952:in `establish_connection'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:60:in `establish_connection'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/base.rb:27:in `<main>'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:356:in `active_record_configured?'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:273:in `disconnect_database'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:107:in `preload'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/kutta/.rbenv/versions/2.6.0/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from -e:1:in `<main>'

#2

Probably your database isn’t compatible with this ruby version… you should change the gem sqlite3 to:
gem “sqlite3”, “~> 1.3.6”… so apply bundle sqlite3 on terminal to download that version of database


#3

The solution @ederknd is referring to is here, but I’m not sure this is the issue for you.

If it is, then basically change the line in the Gemfile gem ‘sqlite3’ to gem ‘sqlite3’, ‘~> 1.3.6’, save the file, and run ‘bundle install’ again (but I’m not seeing that error in anything you show in your post).