Search code examples
node.jssqliteelectronnode-gyp

Build sqlite3 on windows 10 for electron app


I'm trying to make a simple electron app with sqlite3 data storage on windows 10.

Seems like i cannot build sqlite3 because of some node-gyp issues. The stacktrace of the error.

  • rebuilding native production dependencies platform=win32 arch=x64
Error: C:\Program Files\nodejs\node.exe exited with code 1
Output:

> sqlite3@4.0.2 install C:\Users\Ilya\puppy\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

�믮������ ��᫥����⥫쭠� ᡮઠ �஥�⮢ � �⮬ �襭��. �⮡� ������� ��ࠫ������ ᡮ��, ������� ��ࠬ��� "/m".
MSBUILD : error MSB4025: �� 㤠���� ����㧨�� 䠩� �஥��. ��������� ��୥��� �����.
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64 --napi_version=3 --node_abi_napi=napi' (1)

Error output:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v3.0-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.2 and electron@3.0.0 (electron-v3.0 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\Ilya\\puppy\\node_modules\\sqlite3\\lib\\binding\\electron-v3.0-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\Ilya\\puppy\\node_modules\\sqlite3\\lib\\binding\\electron-v3.0-win32-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd C:\Users\Ilya\puppy\node_modules\sqlite3
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.8.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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Ilya\puppy\node_modules\sqlite3\lib\binding\electron-v3.0-win32-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Ilya\puppy\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Ilya\\puppy\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Ilya\puppy\node_modules\sqlite3
node-pre-gyp ERR! node -v v8.11.3
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.2 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\Ilya\AppData\Roaming\npm-cache\_logs\2018-10-07T18_17_21_376Z-debug.log

    at ChildProcess.childProcess.once.code (C:\Users\Ilya\puppy\node_modules\builder-util\src\util.ts:254:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
    at rebuild (C:\Users\Ilya\puppy\node_modules\app-builder-lib\out\util\yarn.js:239:18)
    at C:\Users\Ilya\puppy\node_modules\app-builder-lib\src\util\yarn.ts:20:11
From previous event:
    at installOrRebuild (C:\Users\Ilya\puppy\node_modules\app-builder-lib\out\util\yarn.js:68:17)
    at C:\Users\Ilya\puppy\node_modules\electron-builder\src\cli\install-app-deps.ts:56:9
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at installAppDeps (C:\Users\Ilya\puppy\node_modules\electron-builder\out\cli\install-app-deps.js:174:17)
    at main (C:\Users\Ilya\puppy\node_modules\electron-builder\src\cli\install-app-deps.ts:65:10)
    at Object.<anonymous> (C:\Users\Ilya\puppy\node_modules\electron-builder\src\cli\install-app-deps.ts:70:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppy@1.0.0 postinstall: `install-app-deps`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppy@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\Ilya\AppData\Roaming\npm-cache\_logs\2018-10-07T18_17_21_461Z-debug.log

What i've tried but it does not help:

  • install python2.7 and then npm config set --python=C:\path\to\python
  • npm install --global --production windows-build-tools
  • running npm install as administrator
  • running npm install from VS2017 console
  • updating npm and node-gyp version
  • deleting my node-modules and installing again

It is all the same, I keep receiving this error. Have you any ideas how to make sqlite3 build possible?

Node version: 8.11.3 NPM version: 5.6.0


Solution

  • I think the reason is that sqlite3@4.0.2 seems to be not (yet) compatible with recently released electron@3.0.3. When you have a look at your log you can see that downloading the according package failed:
    node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v3.0-win32-x64.tar.gz

    Instead, when you try to open https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/electron-v2.0-win32-x64.tar.gz in your browser, it works.

    I'm currently discovering the same issue. Using an older version of electron works for me. My package.json looks something like this:
    "sqlite3": "^4.0.2", ... "electron": "2.0.7", "electron-builder": "20.28.1",

    Hope that helps!


    Update: A few days ago sqlite3@4.0.3 has been published. This version resolves the issue and can now be used along with electron@3.0.6. My dependencies look like this now:
    "sqlite3": "^4.0.3", ... "electron": "3.0.6", "electron-builder": "20.28.4",