I'm stuck on that damn 'sqlite' problem! (Update: Fixed!)


#1

UPDATE: I started from scratch and found my problem. Here’s TOP’s first step if you get an error:

"(Feb 8, 2019) NOTE: If you get an error with the above command, follow these steps:

  1. Open your Gemfile in a text editor. If you use VSCode, you can do that by typing code Gemfile. Change the line that reads gem ‘sqlite3’ to gem ‘sqlite3’ , ‘~> 1.3.13’. Save the file."

So I didn’t realize when it tells me to open Gemfile in a text editor, it wants me to go back to the terminal to type “code Gemfile.” Once I did that, it generated a new file over in VSC. I was using an old file opened in VSCode, thinking it worked for all projects. Maybe I’m the only one, but I think that should be made more explicit in the instructions.
END UPDATE

[MacBook Pro & VSCode] Hi, everybody. I checked out all the similar topics in the forum having to do with the same problem. I’m noticing even after I fix the Gemfile and save in VSCode, my error after re-entering “rails generate scaffold car make:string model:string year:integer” I get an error and something about sqlite3-1.4.0. The solution from u/1stevengrant didn’t work for me. Here’s what I have:

Daniels-MacBook-Pro-2:my_first_rails_app danielscannell$ rails db:migrate
/Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.2/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /Users/danielscannell in PATH, mode 040777
rails aborted!
LoadError: 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.
/Users/danielscannell/odin_on_rails/my_first_rails_app/bin/rails:9:in <top (required)>' /Users/danielscannell/odin_on_rails/my_first_rails_app/bin/spring:15:in<top (required)>’
bin/rails:3:in load' bin/rails:3:in

Also included is my VSCode just to confirm sqlite was changed in the right place.

I’ve gone back retraced my steps 5 times. Why is this happening?


#2

I think you need to add a ’ after '~> 1.1.13…so it will read gem ‘sqlite3’ , ‘~> 1.1.13’


#3

I would remove the version number at the back (1.xxx) to begin with.
You already have sqlite3 version 1.4.0 somewhere in your gemfile.

I took it from this line
“”“Using sqlite3 1.4.0"”"


#4

@nhernandez7718 is correct, the line on your Gemfile is improperly closed. You’re missing a '.


#5

@HotdogGo2Bathroom

I removed part of your post which exposed your ssh key. The key is used to confirm your identity to other hosts and therefore anybody who has access to your key could potentially gain access to at least some parts of those other hosts such as github, heroku etc.

You should never expose this key to anyone.


#6

Like this?

Tried that, closed it with an apostrophe, and saved it. Reinstalled bundle and entered the “rails generate scaffold car…” stuff. I got this again:

Daniels-MacBook-Pro-2:my_first_rails_app danielscannell$ rails generate scaffold car make:string model:string year:integer
/Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.2/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /Users/danielscannell in PATH, mode 040777
/Users/danielscannell/.rbenv/versions/2.6.1/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)


#7

Thank you. Everything else is safe to share?


#8

I’m waiting to see if that was the only problem. Even after adding it and saving I get:
Daniels-MacBook-Pro-2:my_first_rails_app danielscannell$ rails generate scaffold car make:string model:string year:integer
/Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.2/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /Users/danielscannell in PATH, mode 040777
/Users/danielscannell/.rbenv/versions/2.6.1/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)


#10

Hi I was able to solve the same problem thanks to @1stevengrant (Thanks brother!!)

"Having just tried to setup my own Mac with the guide here on TOP, this worked for me:

Open the Gemfile inside my_first_rails_app and change gem ‘sqlite3’ to gem ‘sqlite3’, ‘~> 1.3.6’

Save the file.

From Terminal, run bundle install"


#11

Sounds like you forgot to run bundle install after saving?


#12

Yeah, I definitely did bundle install after saving in VSC. I still get this:
Bundle complete! 18 Gemfile dependencies, 79 gems now installed.
Use bundle info [gemname] to see where a bundled gem is installed.
Daniels-MacBook-Pro-2:my_first_rails_app danielscannell$ rails generate scaffold car make:string model:string year:integer
/Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.2/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /Users/danielscannell in PATH, mode 040777
/Users/danielscannell/.rbenv/versions/2.6.1/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 /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:12:in
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:inblock in require_with_bootsnap_lfi’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in register' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:inrequire_with_bootsnap_lfi’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:inblock in require’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in load_dependency' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:inrequire’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/connection_specification.rb:191:in spec' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:952:inestablish_connection’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:60:in establish_connection' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/railtie.rb:136:inblock (2 levels) in class:Railtie
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in instance_eval' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:inblock in execute_hook’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:62:in with_execution_control' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:67:inexecute_hook’
from /Users/danielscannell/.rbenv/versions/2.6.1/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 /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:ineach’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in run_load_hooks' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/base.rb:328:inmodule:ActiveRecord
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activerecord-5.2.2/lib/active_record/base.rb:27:in <main>' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:inrequire’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:inregister’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:inrequire’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in block in require' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:inload_dependency’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:356:inactive_record_configured?’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:273:in disconnect_database' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:107:inpreload’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:153:in serve' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:141:inblock in run’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:135:in loop' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:135:inrun’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in <top (required)>' from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:inrequire’
from /Users/danielscannell/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' from -e:1:in
Daniels-MacBook-Pro-2:my_first_rails_app danielscannell$

Any ideas?


#13

So in VSCode, or whatever you’re using, you did ‘sqlite3’, ‘~> 1.3.6’ and not 1.3.13? I’ve also tried 1.4.0 to no avail. Saved and bundle install after each.


#14

Here’s my Gemfile.lock. Does it look like I’m missing anything?

remote: https://rubygems.org/
specs:
actioncable (5.2.2)
actionpack (= 5.2.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.2)
actionpack (= 5.2.2)
actionview (= 5.2.2)
activejob (= 5.2.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.2)
actionview (= 5.2.2)
activesupport (= 5.2.2)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.2)
activesupport (= 5.2.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.2)
activesupport (= 5.2.2)
globalid (>= 0.3.6)
activemodel (5.2.2)
activesupport (= 5.2.2)
activerecord (5.2.2)
activemodel (= 5.2.2)
activesupport (= 5.2.2)
arel (>= 9.0)
activestorage (5.2.2)
actionpack (= 5.2.2)
activerecord (= 5.2.2)
marcel (~> 0.3.1)
activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
archive-zip (0.12.0)
io-like (~> 0.3.0)
arel (9.0.0)
bindex (0.5.0)
bootsnap (1.4.1)
msgpack (~> 1.0)
builder (3.2.3)
byebug (11.0.0)
capybara (3.14.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (2.1.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.4)
crass (1.0.4)
erubi (1.8.0)
execjs (2.7.0)
ffi (1.10.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.3)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
msgpack (1.2.7)
multi_json (1.13.1)
nio4r (2.3.1)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
pg (1.1.4)
public_suffix (3.0.3)
puma (3.12.0)
rack (2.0.6)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.2)
actioncable (= 5.2.2)
actionmailer (= 5.2.2)
actionpack (= 5.2.2)
actionview (= 5.2.2)
activejob (= 5.2.2)
activemodel (= 5.2.2)
activerecord (= 5.2.2)
activestorage (= 5.2.2)
activesupport (= 5.2.2)
bundler (>= 1.3.0)
railties (= 5.2.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.2)
actionpack (= 5.2.2)
activesupport (= 5.2.2)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
regexp_parser (1.3.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
turbolinks (5.2.0)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)

PLATFORMS
ruby

DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
capybara (>= 2.15)
chromedriver-helper
coffee-rails (~> 4.2)
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
pg
puma (~> 3.11)
rails (~> 5.2.2)
sass-rails (~> 5.0)
selenium-webdriver
spring
spring-watcher-listen (~> 2.0.0)
sqlite3 (~> 1.3.13)
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)

RUBY VERSION
ruby 2.6.1p33

BUNDLED WITH
1.17.2


#15

Thank you for this! I was stuck with the same issue since yesterday.