简体   繁体   中英

After adding sqlite3 to Electron-forge app, app wont run anymore

i am trying to integrate sqlite3 into my electron-forge application. But whatever I try it always fails. I have tried

  1. using "scripts": {"postinstall": "install-app-deps",}
  2. installing it with npm install sqlite3 --build-from-source
  3. using electron-rebuild like so "scripts": {"rebuild": "electron-rebuild -f -w sqlite3"}

all of the above came from some post somewhere where people would have issues in using sqlite3 in conjunction with electron-forge. Now the problem is that after I did any if the above mentioned things when I try to run my app I get the following (edited paths)

An unhandled error has occurred inside Forge:
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm�glichen, m�ssen Sie den Schalter "/m" hinzuf�gen.
  unpack_sqlite_dep
  sqlite3.c
  win_delay_load_hook.cc
  sqlite3.vcxproj -> C:\...\angular\node_modules\sqlite3\build\Release\\sqlite3.lib
  database.cc
  node_sqlite3.cc
  statement.cc
  win_delay_load_hook.cc
..\src\database.cc(49): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\...\angular\node_modules\sqlite3\build\node_sqlite3.vcxproj]
  C:\...\angular\node_modules\sqlite3\node_modules\nan\nan.h(929): note: see declaration of 'Nan::MakeCallback'

And a ton more like these warnings.

And somewhere in between all these warnings I actualy get one error:

C:\...\.electron-gyp\.node-gyp\iojs-3.0.13\x64\iojs.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2F866A [C:\...\angular\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:\...\angular\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:\\...\\angular\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=3.0.13" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=C:\\...\\angular\\node_modules\\sqlite3\\lib\\binding\\electron-v3.0-win32-x64" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.6/{toolset}/" "--package_name=electron-v3.0-win32-x64.tar.gz"
gyp ERR! cwd C:\...\angular\node_modules\sqlite3
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

With all these warnings and that one error I am totaly lost, so any help is very much appreciated.

With electron-forge, there seems to be some problem running the app with sqlite3. Try making sqlite3 (I am using better-sqlite3) as an external dependency in your webpack configuration.

  externals: {
    'better-sqlite3': 'commonjs better-sqlite3',
  },

This works in the dev environment but it fails in the build (after running make).
The better-sqlite3 won't be found in the build, since we have made it external dependency.

Didn't get a proper solution yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM