NW.js is like electron but has some advantages like code protection etc.
However better-sqlite3 ist not running with nw.js. Here the error
174 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
175 verbose lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/timebro/timeBro/git/mac/front/timeBro.app/Contents/Resources/app.nw/node_modules/better-sqlite3/node_modules/.bin:/Users/timebro/timeBro/git/mac/front/timeBro.app/Contents/Resources/app.nw/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
176 verbose lifecycle [email protected]~install: CWD: /Users/timebro/timeBro/git/mac/front/timeBro.app/Contents/Resources/app.nw/node_modules/better-sqlite3
177 silly lifecycle [email protected]~install: Args: [ '-c', 'node deps/install' ]
178 silly lifecycle [email protected]~install: Returned: code: 1 signal: null
179 info lifecycle [email protected]~install: Failed to exec install script
180 verbose unlock done using /Users/timebro/.npm/_locks/staging-ab38ca7a6a6822fb.lock for /Users/timebro/timeBro/git/mac/front/timeBro.app/Contents/Resources/app.nw/node_modules/.staging
181 warn [email protected] No description
182 warn [email protected] No repository field.
183 warn [email protected] license should be a valid SPDX license expression
184 verbose stack Error: [email protected] install: node deps/install
184 verbose stack Exit status 1
184 verbose stack at EventEmitter.
184 verbose stack at emitTwo (events.js:125:13)
184 verbose stack at EventEmitter.emit (events.js:213:7)
184 verbose stack at ChildProcess.
184 verbose stack at emitTwo (events.js:125:13)
184 verbose stack at ChildProcess.emit (events.js:213:7)
184 verbose stack at maybeClose (internal/child_process.js:887:16)
184 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
185 verbose pkgid [email protected]
186 verbose cwd /Users/timebro/timeBro/git/mac/front/timeBro.app/Contents/Resources/app.nw
187 verbose Darwin 16.6.0
188 verbose argv "/usr/local/Cellar/node/8.0.0_1/bin/node" "/usr/local/bin/npm" "install" "better-sqlite3" "--save"
189 verbose node v8.0.0
190 verbose npm v5.4.0
191 error code ELIFECYCLE
192 error errno 1
193 error [email protected] install: node deps/install
193 error Exit status 1
194 error Failed at the [email protected] install script.
194 error This is probably not a problem with npm. There is likely additional logging output above.
195 verbose exit [ 1, true ]
Still no decision?
I don't really plan on investigating the installation issues related to Electron, nw.js, etc. As far as I'm concerned better-sqlite3 is a Node.js package, and if third parties like Electron claim to support Node.js, it's their problem when they fail to satisfy that promise. I imagine that issues with nw.js are similar to issues with Electron, which I've delegated to a special thread here. If the Electron or nw.js community is passionate enough to solve these problems, I welcome the support.
I can understand that you don鈥榯 have the time to do that. Yet I would recommend to leave the case open if you change your mind in the fufure.
Nw.js and electron are ok the rise and SQLite fits perfectly for their needs. The propability to use it is much high than on node.js servers that can easily use mysql instead.
Your framework would find a large user base where you could easily find someone to help you keeping track with nw.js and electron versions ;)
Just to be clear, nwjs isn't quite like electron in this regard. Modules need to be built from source with nw-gyp. I've tried replacing 'sqlite3' with 'better-sqlite3' in the commands stated on the sqlite3 documentation but had no luck. If I get it working, I'll post back.
For me it compiles without any error "nw-gyp rebuild --target=0.29.3 --arch=x64". but running the exemple code causes nw.js to crash with no logs or anything.
i was not able to go further.
nw.js version 0.29.3-win-x64
C:\PlayGround\package.nw\node_modules\better-sqlite3>nw-gyp rebuild --target=0.29.3 --arch=x64 --msvs_version=2015
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Users\HP\.windows-build-tools\python27\python.EXE
gyp info spawn args [ 'C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\\PlayGround\\\package.nw\\node_modules\\better-sqlite3\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\HP\\.nw-gyp\\0.29.3\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\HP\\.nw-gyp\\0.29.3',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\nw-gyp',
gyp info spawn args '-Dnode_lib_file="C:\\Users\\HP\\.nw-gyp\\0.29.3\\<(target_arch)\\node.lib"',
gyp info spawn args '-Dnw_lib_file="C:\\Users\\HP\\.nw-gyp\\0.29.3\\<(target_arch)\\nw.lib"',
gyp info spawn args '-Dmodule_root_dir=C:\\PlayGround\\package.nw\\node_modules\\better-sqlite3',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '-Dv13=1',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\PlayGround\\package.nw\\node_modules\\better-sqlite3\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
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:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\\sqlite3.lib
better_sqlite3.cpp
win_delay_load_hook.cc
Creating library C:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\better_sqlite3.lib and
object C:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\better_sqlite3.exp
Generating code
All 4032 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
better_sqlite3.vcxproj -> C:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\\better_sqlite3.
node
better_sqlite3.vcxproj -> C:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\better_sqlite3.p
db (Full PDB)
test_extension.c
win_delay_load_hook.cc
Generating code
All 2 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
test_extension.vcxproj -> C:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\\test_extension.
node
test_extension.vcxproj -> C:\PlayGround\package.nw\node_modules\better-sqlite3\build\Release\test_extension.p
db (Full PDB)
gyp info ok
sames goes for me nw-gyp rebuild --target=0.26.0 --arch=ia32 --verbose
Most helpful comment
I can understand that you don鈥榯 have the time to do that. Yet I would recommend to leave the case open if you change your mind in the fufure.
Nw.js and electron are ok the rise and SQLite fits perfectly for their needs. The propability to use it is much high than on node.js servers that can easily use mysql instead.
Your framework would find a large user base where you could easily find someone to help you keeping track with nw.js and electron versions ;)