5

I'm trying to build one small desktop app using:

  • Angular 4+
  • NodeJS
  • Electron
  • SQLite3

NodeJS will be used for scanning local user hdd and inserting specific files that are found into SQLite3 database.

I checked dozens of documentation and suggestions. Most of them suggest to use NodeJS Express framework and make layer between Angular 4+ -> Express -> SQLite3.

I want to avoid using Express framework because it is going to be desktop app and it is not needed at all.

What I tried and what I did:

I installed:

   "sqlite3": "^3.1.9",
   "node-pre-gyp": "^0.6.36",

as dependencies in my project.

Than I have read if you want to use native nodejs library you should run electron rebuild. So I installed also electron rebuild:

"electron-rebuild": "^1.6.0"

as a devDependencies and run it with following command:

./node_modules/.bin/electron-rebuild

Rebuild sqlite3 successfully finished.

Than I run electron application and I get following error:

/~/node-pre-gyp/lib/node-pre-gyp.js
Module build failed: Error: ENOENT: no such file or directory, open '/home/haris/development/walter/angular-electron-starter/node_modules/node-pre-gyp/lib/node-pre-gyp.js'
    at Error (native)
 @ ./~/sqlite3/lib/sqlite3.js 1:13-36
 @ ./src/app/home/home.component.ts
 @ ./src/app/home/index.ts
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts

I'm stuck here. I tried many more things like:

1. Removing node_modules
2. npm install --build-from-source

but still I'm getting the same error.

6
  • In my limited experience, a common reason for node-gyp / node-pre-gyp to buid is because of missing build-tools. What OS are you on? Commented Sep 6, 2017 at 11:35
  • @ippi I'm using Linux / Ubuntu 16.04 ( 64bit ). Commented Sep 6, 2017 at 11:37
  • With alpine you need at least make gcc g++ python for node-gyp. Not sure about ubuntu. Commented Sep 6, 2017 at 11:40
  • (Also I think your real error is elsewhere) Commented Sep 6, 2017 at 11:41
  • @ippi I'm struggling more than two days to find where is the problem but still without success. Thanks for your help. Commented Sep 7, 2017 at 9:46

2 Answers 2

5

I've just published a sample project which shows how to build a desktop app using Electron, Angular4 and Sqlite3. You can clone it here

Note I've node-gyp globally installed.

Hope it helps

Sign up to request clarification or add additional context in comments.

Comments

0

For what it might be worth to others. I had followed the steps from @leota (very good thank you BTW!).

My problem is I had Python 2.7 x64 version, and I think it needed the 32 bit version.. as I installed the standard version, my rebuild process worked fine!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.