0

I'm new to Rails, and I'm learning it from The Ruby on Rails Tutorial. The bundle install command shows this error when I use gem 'sqlite3' in Gemfile;

    An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
    Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'`
    succeeds before bundling.

In Gemfile:
  sqlite3

I found a solution to this over here - https://medium.com/@declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b, that suggested that gem 'sqlite3' should be replaced with gem ‘sqlite3’, git: “https://github.com/larskanis/sqlite3-ruby", branch: “add-gemspec”. On running bundle install after upating Gemfile, all the required gems, including sqlite3, appear to have installed;

Bundle complete! 15 Gemfile dependencies, 70 gems now installed.
Use 'bundle info [gemname]' to see where a bundled gem is installed.

But on running the command sqlite3 --version, I still get the error message that says

'sqlite3' is not recognized as an internal or external command,
operable program or batch file.

I have also referred to various stackoverflow answers, but none of them seem to work. gem install sqlite3 is also not working. Please help.

  • Have you tried separately installing pre-compiled SQLIte binaries? https://www.sqlite.org/download.html – rmlockerd Jul 13 '21 at 08:01
  • @rmlockerd, no I haven't. Thank you for the suggestion. Going to try it out. – thunderdog Jul 13 '21 at 08:05
  • @rmlockerd, sorry that didn't work. Is there any other way to fix this issue? – thunderdog Jul 13 '21 at 08:16
  • sqlite itself must be installed before you install the ruby gem: https://www.tutorialspoint.com/sqlite/sqlite_installation.htm – Arctodus Jul 13 '21 at 11:53
  • @Sharagoz sqlite3 has installed on my system, but the `rails server` command still returns an error. `bundle info [sqlite3]` also lists sqlite3, and also indicates where it is installed. Is it because I am using a Windows 10 pc? – thunderdog Jul 14 '21 at 04:04
  • 1
    I figured out how to fix it. I just uninstalled Ruby and all the gems (I think i had accidentally messed up one of the files) and then re-installed Ruby. After using `gem install rails` and running the `rails new` command I started the server using the command `ruby bin/rails server`. @rmlockerd @Sharagoz thank you, using the pre-compiled binaries to install sqlite3 worked perfectly. – thunderdog Jul 14 '21 at 05:05

1 Answers1

0

try it helped

sudo apt-get install libsqlite3-dev