Răzvan Ilin

Full stack developer, casual traveler, amateur photographer

Using Sequelize with sqlite3 inside an Electron app

Introduction

A few months ago I ran into some problems when I tried to use Sequelize with sqlite3 inside an Electron app. Even though I installed everything properly, I was getting this error:

I was able to fix this using this website but it appears to be down now. I decided to write down the method here and also adding a bit more details on how to solve the problem.

Solution

  • Go to node_modules/sequelize/lib/dialects/connection-manager.js and identify the MODULE_NOT_FOUND error code. Log the error with a console.log(err) before the error is thrown.
  • Run the application and you will get a more detailed error:

{ Error: Cannot find module 'C:\Users\Razvan\Documents\devStuff\work\app\server\node_modules\sqlite3\lib\binding\electron-v1.3-win32-x64\node_sqlite3.node'

  • Note the electron-v1.3-win32-x64. You might have something different depending on the electron version you installed
  • cd node_modules/sqlite3 and then run the following:

  • --module_path replace with what you got from the MODULE_NOT_FOUND error
  • --target_platform win32, darwin or linux
  • --arch x64 or ia32
  • --target the version of electron you are using

 

If there are issues on Windows about MSB4019, check this issue https://github.com/brianmcd/contextify/issues/96

That’s all

By following the steps above I managed to make the configuration work on Windows and Mac. Hopefully this solves the problem for you too.

If you still encounter the problem, check this post on stackoverflow. It offers multiple approaches.

 

 

Building a simple game for Android using libGDX #3

In this part we will pay more attention on how the game looks and feels. If you haven’t already, I suggest you to go and check out the other parts (Part 1 & Part 2).

We will build two more screens for the game, one will be the starting screen(menu) from where we can start the game and the other one will be the ending screen which will be triggered when the player loses all of his lives (this screen will have a button that will redirect the player to the starting screen).

This is how the screens will look like:

(more…)

Building a simple game for Android using libGDX #2

A few days ago I made an introduction to the framework we are using to develop the game (libGDX), we set up a workspace, spoke about the game we are going to develop and managed to go through a bit of code that renders the background. If you haven’t already done so, I suggest going through part I before continuing with this one.

In this part of the tutorial we will implement most of the game’s features! I can feel the excitement already!

(more…)

Building a simple game for Android using libGDX #1

I participated in an app jam (AppJam2014) recently and I managed to win it with a simple android game. We had 6-7 hours to do it so I had to be modest and start a small project.

Here is a gameplay video:

I saw this as the perfect opportunity to do my first programming tutorial as I will explain some easy steps in setting up an android project with libGDX and then building the actual game using the framework. You won’t need much experience in programming to do this, but you should have a bit of knowledge in using Java and have an understanding of object-orientation.

(more…)