Hi! first of all, thank you for this small but wonderful boilerplate.
I am April, I am still a student and I am new to electron, I basically came from the background of web development. I have been trying to do this for almost 8 hours now. I followed your instructions and ran the app for the first time, it worked nicely.
I was wondering what I was doing wrong? because in my experience, I have failed to integrate sqlite3 with electron and opened the TryGhost/node-sqlite3#838.
my first experience was using node 6, the module seems to install, but opening the window I get:
module.js:472 Uncaught Error: Cannot find module 'C:\Users\aprilpineda\Documents\projects\desktop\experiments\2-sample\node_modules\sqlite3\lib\binding\electron-v1.6-win32-x64\node_sqlite3.node'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (C:\Users\aprilpineda\Documents\projects\desktop\experiments\2-sample\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\2-sample\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Object.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\2-sample\node_modules\sqlite3\lib\sqlite3.js:190:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
then I upgraded to node 8.1.2 and installed node-gyp globally then installed sqlite3 again (in a different project now, I removed the previous one.) and I got this:
npm install --save sqlite3
> [email protected] install C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
node-pre-gyp verb cli 'C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\experiments\\1-testproject\\node_modules\
\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | win32 | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modu
les\sqlite3\lib\binding\node-v57-win32-x64\node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v57-win32-x64.tar.gz
node-pre-gyp http 200 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v57-win32-x64.tar.gz
node-pre-gyp info install unpacking node_sqlite3.node
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v57-win3
2-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source c
ompile with node-gyp)
node-pre-gyp http read ECONNRESET
node-pre-gyp verb command build [ 'rebuild' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
unpack_sqlite_dep
sqlite3.c
win_delay_load_hook.cc
sqlite3.vcxproj -> C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\bui
ld\Release\\sqlite3.lib
database.cc
node_sqlite3.cc
statement.cc
win_delay_load_hook.cc
..\src\database.cc(133): warning C4996: 'v8::Object::ForceSet': was declared deprecated [C:\Users\aprilpineda\Documents
\projects\desktop\experiments\1-testproject\node_modules\sqlite3\build\node_sqlite3.vcxproj]
c:\users\aprilpineda\.node-gyp\8.1.2\include\node\v8.h(2951): note: see declaration of 'v8::Object::ForceSet'
..\src\statement.cc(103): warning C4996: 'v8::Object::ForceSet': was declared deprecated..\src\database.cc(134): warnin
g C4996: 'v8::Object::ForceSet': was declared deprecated [C:\Users\aprilpineda\Documents\projects\desktop\experiments\1
-testproject\node_modules\sqlite3\build\node_sqlite3.vcxproj]
c:\users\aprilpineda\.node-gyp\8.1.2\include\node\v8.h(2951): note: see declaration of 'v8::Object::ForceSet'
c:\users\aprilpineda\.node-gyp\8.1.2\include\node\v8.h(2951): note: see declaration of 'v8::Object::ForceSet'
..\src\statement.cc(277): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\User
s\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\build\node_sqlite3.vcxproj]
c:\users\aprilpineda\documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\node_modules\nan\nan_new
.h(208): warning C4244: 'argument': conversion from 'sqlite3_int64' to 'double', possible loss of data (compiling sourc
e file ..\src\statement.cc) [C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sql
ite3\build\node_sqlite3.vcxproj]
..\src\statement.cc(479): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::
Number,sqlite3_int64>(A0)' being compiled
with
[
A0=sqlite3_int64
]
c:\users\aprilpineda\documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\node_modules\nan\nan_new
.h(208): warning C4244: 'argument': conversion from 'sqlite3_int64' to 'double', possible loss of data (compiling sourc
e file ..\src\database.cc) [C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqli
te3\build\node_sqlite3.vcxproj]
..\src\database.cc(502): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::N
umber,sqlite3_int64>(A0)' being compiled
with
[
A0=sqlite3_int64
]
C:\Users\aprilpineda\.node-gyp\8.1.2\x64\node.lib : fatal error LNK1127: library is corrupt [C:\Users\aprilpineda\Docum
ents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\build\node_sqlite3.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\nod
e_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\experiment
s\\1-testproject\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\aprilpine
da\\Documents\\projects\\desktop\\experiments\\1-testproject\\node_modules\\sqlite3\\lib\\binding\\node-v57-win32-x64\\n
ode_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\expe
riments\\1-testproject\\node_modules\\sqlite3\\lib\\binding\\node-v57-win32-x64"
gyp ERR! cwd C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3
gyp ERR! node -v v8.1.2
gyp ERR! node-gyp -v v3.6.2
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\aprilpineda\Documents\projec
ts\desktop\experiments\1-testproject\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\a
prilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\node-v57-win32-x64\node
_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-tes
tproject\node_modules\sqlite3\lib\binding\node-v57-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-t
estproject\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:897:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
node-pre-gyp ERR! System Windows_NT 10.0.15063
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\e
xperiments\\1-testproject\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-t
o-build"
node-pre-gyp ERR! cwd C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3
node-pre-gyp ERR! node -v v8.1.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testpr
oject\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\aprilpineda\Documents\projects\d
esktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\node-v57-win32-x64\node_sqlite3.node --module_name=nod
e_sqlite3 --module_path=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\l
ib\binding\node-v57-win32-x64' (1)
npm WARN [email protected] No description
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\aprilpineda\AppData\Roaming\npm-cache\_logs\2017-06-27T15_10_12_645Z-debug.log
In your boilerplate, when I did an npm update
then npm start
I get the same error saying that the module was not found:
Uncaught Error: Cannot find module 'C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64\node_sqlite3.node'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Object.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\sqlite3.js:190:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
then I thought of building it again so I did a npm run postinstall
and got this output:
npm run postinstall
> [email protected] postinstall C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject
> install-app-deps
Rebuilding native production dependencies for win32:x64
Error: C:\Program Files\nodejs\node.exe exited with code 1
Output:
> [email protected] install C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node "" clean )
C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64 --python=C:\Users\aprilpineda\.windows-build-tools\python27\python.exe --msvs_version=2015 ) else (node "" configure --fallback-to-build --module=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64 --python=C:\Users\aprilpineda\.windows-build-tools\python27\python.exe --msvs_version=2015 )
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64 --python=C:\Users\aprilpineda\.windows-build-tools\python27\python.exe --msvs_version=2015' (1)
Error output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
node-pre-gyp verb cli 'C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\experiments\\1-testproject\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | win32 | x64
node-pre-gyp verb command install []
node-pre-gyp info build requesting source compile
node-pre-gyp verb command build [ 'rebuild' ]
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports._errnoException (util.js:1016:11)
gyp ERR! stack at TLSWrap.onread (net.js:609:25)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\experiments\\1-testproject\\node_modules\\sqlite3\\lib\\binding\\electron-v1.7-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\experiments\\1-testproject\\node_modules\\sqlite3\\lib\\binding\\electron-v1.7-win32-x64" "--python=C:\\Users\\aprilpineda\\.windows-build-tools\\python27\\python.exe" "--msvs_version=2015"
gyp ERR! cwd C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3
gyp ERR! node -v v8.1.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\lib\binding\electron-v1.7-win32-x64 --python=C:\Users\aprilpineda\.windows-build-tools\python27\python.exe --msvs_version=2015' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:897:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
node-pre-gyp ERR! System Windows_NT 10.0.15063
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aprilpineda\\Documents\\projects\\desktop\\experiments\\1-testproject\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\sqlite3
node-pre-gyp ERR! node -v v8.1.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\aprilpineda\AppData\Roaming\npm-cache\_logs\2017-06-27T16_07_34_109Z-debug.log
at ChildProcess.childProcess.once.code (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\src\util\util.ts:136:14)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:897:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
From previous event:
at spawn (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\src\util\util.ts:99:3)
at C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\src\yarn.ts:146:11
From previous event:
at rebuild (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\out\yarn.js:81:22)
at C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\src\yarn.ts:15:11
at Generator.next (<anonymous>)
at runCallback (timers.js:800:20)
at tryOnImmediate (timers.js:762:5)
at processImmediate [as _immediateCallback] (timers.js:733:5)
From previous event:
at installOrRebuild (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\out\yarn.js:33:21)
at C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\src\cli\install-app-deps.ts:34:2
at Generator.next (<anonymous>)
From previous event:
at main (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\out\cli\install-app-deps.js:36:21)
at Object.<anonymous> (C:\Users\aprilpineda\Documents\projects\desktop\experiments\1-testproject\node_modules\electron-builder\out\cli\install-app-deps.js:76:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! [email protected] postinstall: `install-app-deps`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the [email protected] 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\aprilpineda\AppData\Roaming\npm-cache\_logs\2017-06-27T16_07_34_282Z-debug.log
I was hoping if you can enlighten me.
here is the package.json
I changed it a bit just to experiment and see how it affects things.
{
"name": "1-testproject",
"description": "",
"version": "1.0.0",
"author": "April Mintac Pineda <[email protected]>",
"license": "UNLICENSED",
"main": "app/app.js",
"build": {
"appId": "com.example.electron-boilerplate-sqlite",
"files": [
"app/**/*",
"node_modules/**/*",
"package.json"
]
},
"scripts": {
"postinstall": "install-app-deps",
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1",
"release": "build"
},
"dependencies": {
"sqlite3": "^3.1.8"
},
"devDependencies": {
"electron": "^1.7.3",
"electron-builder": "^10.8.1"
}
}