SQLite Forum

DESPERATE: Need help getting SQLite working with Electron on Windows 10
Login

DESPERATE: Need help getting SQLite working with Electron on Windows 10

(1.1) By ihatzi on 2020-05-25 03:45:13 edited from 1.0 [link] [source]

I have been trying for weeks to get SQLite installed and working with Electron.
I am on windows 10 and here is my procedure...

Install Node... node-v12.16.3-x64
During install of Node, I do check the box that says "Automatically install the necessary tools"

Next I create a fresh new folder for my Electron project

Then I run...
npm init -y
npm install --save electron
npm install --save sqlite3
npm install --save-dev electron-builder

All of which complete without errors.

Then I add to my package.json under scripts...
"postinstall": "electron-builder install-app-deps"

Then I run..
npm run postinstall

And it throws a bunch of errors, and I am dead in the water!
I cannot get the rebuild to work, am praying someone can help me.

Here is the output from postinstall...

> CMPDB@1.0.0 postinstall D:\dropbox\CMPDB
> electron-builder install-app-deps

  • electron-builder  version=22.6.1
  • rebuilding native dependencies  dependencies=sqlite3@4.2.0 platform=win32 arch=x64
  ⨯ cannot execute  cause=exit status 1
                    out=
    > sqlite3@4.2.0 install D:\dropbox\CMPDB\node_modules\sqlite3
    > node-pre-gyp install --fallback-to-build

    Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
      unpack_sqlite_dep
      'C:\Users\Ion' is not recognized as an internal or external command,
      operable program or batch file.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code 1. [D:\dropbox\CMPDB\node_modules\sqlite3\build\deps\action_before_build.vcxproj]
    Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Ion Hatzithomas\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\dropbox\CMPDB\node_modules\sqlite3\lib\binding\electron-v9.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\dropbox\CMPDB\node_modules\sqlite3\lib\binding\electron-v9.0-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v9.0' (1)

                    errorOut=node-pre-gyp WARN Using needle for node-pre-gyp https download
    node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/electron-v9.0-win32-x64.tar.gz
    node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.2.0 and electron@9.0.0 (electron-v9.0 ABI, unknown) (falling back to source compile with node-gyp)
    gyp ERR! build error
    gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
    gyp ERR! stack     at ChildProcess.onExit (C:\Users\Ion Hatzithomas\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    gyp ERR! System Windows_NT 10.0.18362
    gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Ion Hatzithomas\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\dropbox\\CMPDB\\node_modules\\sqlite3\\lib\\binding\\electron-v9.0-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\dropbox\\CMPDB\\node_modules\\sqlite3\\lib\\binding\\electron-v9.0-win32-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v9.0"
    gyp ERR! cwd D:\dropbox\CMPDB\node_modules\sqlite3
    gyp ERR! node -v v12.16.3
    gyp ERR! node-gyp -v v5.1.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Ion Hatzithomas\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\dropbox\CMPDB\node_modules\sqlite3\lib\binding\electron-v9.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\dropbox\CMPDB\node_modules\sqlite3\lib\binding\electron-v9.0-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v9.0' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Dropbox\CMPDB\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
    node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
    node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    node-pre-gyp ERR! System Windows_NT 10.0.18362
    node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Dropbox\\CMPDB\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd D:\dropbox\CMPDB\node_modules\sqlite3
    node-pre-gyp ERR! node -v v12.16.3
    node-pre-gyp ERR! node-pre-gyp -v v0.11.0
    node-pre-gyp ERR! not ok
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! sqlite3@4.2.0 install: `node-pre-gyp install --fallback-to-build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the sqlite3@4.2.0 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Ion Hatzithomas\AppData\Roaming\npm-cache\_logs\2020-05-25T01_12_42_765Z-debug.log

                    command='C:\Program Files\nodejs\node.exe' 'C:\Users\Ion Hatzithomas\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js' rebuild sqlite3@4.2.0
                    workingDir=
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! CMPDB@1.0.0 postinstall: `electron-builder install-app-deps`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the CMPDB@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ion Hatzithomas\AppData\Roaming\npm-cache\_logs\2020-05-25T01_12_42_818Z-debug.log

(2) By Stephan Beal (stephan) on 2020-05-25 08:28:38 in reply to 1.1 [link] [source]

I have been trying for weeks to get SQLite installed and working with Electron.

This is a nodejs issue, unrelated to the core sqlite project. You'll need to contact the Electron devs about this.

(3) By TripeHound on 2020-05-25 09:13:03 in reply to 1.1 [link] [source]

As Stephan says, this is a problem with the Electron scripts, not with SQLite. Specifically, from the error near the top of the log:

    Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
      unpack_sqlite_dep
      'C:\Users\Ion' is not recognized as an internal or external command,
      operable program or batch file.

when your "users" directory is C:\Users\Ion Hatzithomas one can see that the script isn't coping with spaces in the installation path, and should be brought up with whoever packages Electron.

If you are able to choose a different installation directory (one without spaces), that might work in the interim. Another possibility would be to create a new Windows user without a space in it (e.g. C:\Users\IonH) and try things logged-in as that user.

(4.1) By ihatzi on 2020-05-25 13:24:02 edited from 4.0 in reply to 1.1 [link] [source]

Thanks so much, Just submitted a bug report over at Github

https://github.com/electron/electron/issues/23751

(5.1) By ihatzi on 2020-05-25 13:24:06 edited from 5.0 in reply to 4.0 [link] [source]

Deleted

(6) By Decker (d3x0r) on 2020-05-26 01:50:43 in reply to 1.1 [source]

npmjs.org/ https://www.npmjs.com/package/sack.vfs#sqlite-interface I have this sqlite wrapper for node as an alternative.

(7.1) By pw (gudguy1a) on 2022-03-13 19:45:06 edited from 7.0 in reply to 1.1 [link] [source]

Okay, late to this party.

For anyone else with this issue. There IS a youtube video, short, but it solves the problem.

Basically uninstall the package and re-install it.

Close Atom - re-start it - problem gone (for me anyway)

Failed to activate the pigments package in ATOM editor

I also wrote up a quick little blurb on one of my sites:

Atom IDE — Cannot find module

(8) By pw (gudguy1a) on 2022-03-13 19:44:05 in reply to 7.0 [link] [source]

I also wrote up a quick little blurb on one of my sites:

Atom IDE — Cannot find module --- patrick642stuff.wordpress.com/2022/03/13/atom-ide-cannot-find-module/