Ask A Question

Notifications

You’re not receiving notifications from this thread.

How I setup sqlite3 on Ruby on windows

Gabriel Baldez asked in Ruby

I installed sqlite3 in my system when I run sqlite3 --version this appears:
3.37.0 2021-11-27 14:13:22 bd41822c7424d393a30e92ff6cb254d25c26769889c1499a18a0b9339f5d6c8a

But when I try run the server or the command bundle install this message appears:
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.

In Gemfile:
sqlite3

I already have try so many things, edit Gemfile, put sqlite3.dll and sqlite3.def on bin folder on Ruby. Run this command to try get sqlite3 using the source rubygems.org.
Now I go try using WSL. Somebody can help me?

Reply

If you are using Windows use chocolatey to install your sqlite package and dev libraries

choco install sqlite

personally do your ruby/rails work under WSL2 if you want a fun time under windows. since WSL2 now supports systemd you will be able to do 100% the same as you would as a full ubuntu instance

use this guide to get WSL2 running
https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#1-overview

Reply

It sounds like there might be an issue with your system environment variables or path settings. Here are a few things you can try:

Ensure that you have installed the sqlite3 development package for your system. This package contains the necessary header files and libraries needed to compile the sqlite3 Ruby gem. You can usually install this package using your system's package manager.

Ensure that the path to the sqlite3 executable is included in your system's PATH environment variable. You can check this by running echo $PATH in your terminal. If the path to sqlite3 is not included, you can add it by editing your system's environment variables.

Try installing the sqlite3 gem with the --with-sqlite3-dir flag, specifying the path to your sqlite3 installation. For example:

javascript

gem install sqlite3 -- --with-sqlite3-dir=/usr/local/opt/sqlite

Note that the exact path may vary depending on your system.

If you are still having issues, you can try using the sqlite3-ruby gem instead of the sqlite3 gem. This gem is a pure-Ruby implementation of the sqlite3 API, and may be easier to install.

Finally, if you are using WSL, you may need to ensure that the sqlite3 package is installed within your WSL environment, rather than your host Windows environment.

I hope this helps!

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 72,152+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.