Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NW.js + Sqlite3 + Angular 9: can't run node-main script which contains sqlite3. #7486

Closed
vatsalkgor opened this issue May 21, 2020 · 1 comment

Comments

@vatsalkgor
Copy link

I'm using nw-angular-cli-example as a boilerplate for angular and nwjs project. I'm trying to add backend into the project. For that many tutorial suggests I should go like Angular->Express->SQLite. In which Angular is used for UI, Express is used for building an API and the api endpoints perform read write operations on the SQLite. I'm using node-sqlite3 for this project. When I try building it with nw-gyp using the instruction provided in node-sqlite3, the build is successful. However, when I try importing sqlite3 in my project I get the following error.

Screen Shot 2020-05-21 at 18 10 10

The manual build is successful and the sqlite3 directory structure in node_modules folder is same as one would expect it to be after a manual build.
Screen Shot 2020-05-21 at 18 23 52

NWJS Version : 0.46.0
Operating System : MacOS 10.15.4
NodeJS version 14.2.0

Expected behavior

The sqlite3 should be working without looking for node-gyp built package.

Actual behavior

The error as described in the first image.

How to reproduce

  • You can find the repo for issue here.
  • I used the following command to build the sqlite3 for my laptop
    npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=x64 --target=0.46.0 --save
@TheJaredWilcurt TheJaredWilcurt changed the title NwJS + Sqlite3 + Angular 9: can't run node-main script which contains sqlite3. NW.js + Sqlite3 + Angular 9: can't run node-main script which contains sqlite3. May 21, 2020
@vatsalkgor
Copy link
Author

Found a solution using better-sqlite3. Everything works like a charm with better-sqlite3. The complete boilerplate can be found here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant