Reputation: 1
I'm tryin to build an app which requires sqlite3 Modul.
My app works fine when I run it from cmd node server.js
but when I run it from NWJS crashes and throws the error below
Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\Coder Bilall\Desktop\My Work\NWJS\GMoney\Gmoney\node_modules\sqlite3\lib\binding\napi-v3-win32-x64\node_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1206:18)
at Module.load (node:internal/modules/cjs/loader:991:32)
at Function.Module._load (node:internal/modules/cjs/loader:831:14)
at Module.require (node:internal/modules/cjs/loader:1015:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\Coder Bilall\Desktop\My Work\NWJS\GMoney\Gmoney\node_modules\sqlite3\lib\sqlite3-binding.js:4:15)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1161:10)
at Module.load (node:internal/modules/cjs/loader:991:32)
at Function.Module._load (node:internal/modules/cjs/loader:831:14)
My server.js Code
const express = require('express')
const sqlite3 = require('sqlite3').verbose();
const LocalStorage = require('node-localstorage').LocalStorage;
let exec = require('child_process').exec, child;
const connectionTester = require('connection-tester');
const notifier = require('node-notifier');
const path = require('path');
const fs = require('fs');
const os = require('os');
const readline = require('readline');
const {google} = require('googleapis');
const ToCsv = require("sqlite-to-csv");
var cookieParser = require('cookie-parser')
const mailjet = require ('node-mailjet')
.connect('878dcf9b5a0ae7cf07498b6ab3d73ca7', 'c6c90ff0878e2b9640a6c342f84e142e')
const db = new sqlite3.Database('mydb.db');
const application = express();
application.use(cookieParser());
const port = 2020;
application.get('/', (req, res) => {
res.send('Hello World');
});
application.listen(port, () => {
console.log(`Example application listening at http://localhost:${port}`)
})
Please Help me 🥺🥺🥺🥺
Upvotes: 0
Views: 1793
Reputation: 2022
The code failing is referencing a node binding sqlite3\lib\binding\napi-v3-win32-x64
.
When you npm install
some node modules will download or build files unique to your operating system (win32
, linux
, darwin
), your architecture (x86
, x64
), and your Node.js ABI Version (47
, 72
, 88
). If your globally installed version of Node is not the same as the version built in to NW.js, your module will be incompatible.
Try this:
node_modules
and package-lock.json
npm install
and see if it worksThis may not be your issue, but it may resolve other issues and is quick to test.
What version of Node.js is in NW.js?
How do I switch Node.js versions globally?
nvm
you installed. Use it to install and switch to the correct Node.js versionYou may also want to look at this NW.js wiki page:
Upvotes: 1