TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.23k stars 817 forks source link

sqlite3 crash on require with nw.js node.js app #1753

Open hayesgr opened 10 months ago

hayesgr commented 10 months ago

Issue Summary

Appears to be installing wrong module. I am running windows 10. I used npm i sqlite3 -D the first time. The program crashed application crashed after including the "const sqlite3 = require('sqlite3').verbose();" It gave no visible error.

Steps to Reproduce

Running on windows 10 Create basic nwjs project with nodejs make sure it works then try adding sqlite3 to project. Once you put the line shown above it will crash. when you try and run it.

Version

5.1.7

Node.js Version

20.11.0

How did you install the library?

npm i sqlite3

woodbri commented 5 months ago

I have the same problem. I have also tried using import sqlite3 from 'sqlite3'; by adding '"type":"module"` in the package.json file. If I run it with node inspect like:

$ node inspect test2
< Debugger listening on ws://127.0.0.1:9229/6ac6169c-e11b-4540-834f-4424cb5ad943
< For help, see: https://nodejs.org/en/docs/inspector
<
connecting to 127.0.0.1:9229 ... ok
Break on start in test2:1
> 1 #!/usr/bin/env node
  2
  3 import sqlite3 from 'sqlite3';
debug> n
debug> There was an internal error in Node.js. Please report this bug.
read ECONNRESET
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: kill EPERM
    at ChildProcess.kill (node:internal/child_process:512:26)
    at process.handleUnexpectedError (node:internal/debugger/inspect:360:42)
    at process.emit (node:events:531:35)
    at process.emit (node:domain:488:12)
    at process._fatalException (node:internal/process/execution:178:25)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.kill (node:internal/child_process:512:12)
    at process.handleUnexpectedError (node:internal/debugger/inspect:360:42)
    [... lines matching original stack trace ...]
    at process._fatalException (node:internal/process/execution:178:25) {
  errno: -4048,
  code: 'EPERM',
  syscall: 'kill'
}

Node.js v21.7.2
woodbri@DESKTOP-MD7Q6H6 MINGW64 ~/work/test-sqlite3
$ uname -a
MINGW64_NT-10.0-19045 DESKTOP-MD7Q6H6 3.5.3.x86_64 2024-05-06 06:45 UTC x86_64 Msys

woodbri@DESKTOP-MD7Q6H6 MINGW64 ~/work/test-sqlite3
$ node -v
v21.7.2

woodbri@DESKTOP-MD7Q6H6 MINGW64 ~/work/test-sqlite3
$ npm -v
10.5.0
woodbri commented 5 months ago

I also tried to load sqlte3@5.1.6 and it also fails with node -e 'require("sqlite3") with the following:

$ node -e 'require("sqlite3")'
node:internal/modules/cjs/loader:1464
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\msys64\home\woodbri\work\test-sqlite3\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-
x64\node_sqlite3.node
    at Module._extensions..node (node:internal/modules/cjs/loader:1464:18)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (C:\msys64\home\woodbri\work\test-sqlite3\node_modules\sqlite3\lib\sqlite3
-binding.js:4:17)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v21.7.2