[英]After adding sqlite3 to Electron-forge app, app wont run anymore
i am trying to integrate sqlite3 into my electron-forge application.我正在尝试将 sqlite3 集成到我的电子锻造应用程序中。 But whatever I try it always fails.
但无论我尝试什么,它总是失败。 I have tried
我试过了
"scripts": {"postinstall": "install-app-deps",}
"scripts": {"postinstall": "install-app-deps",}
npm install sqlite3 --build-from-source
npm install sqlite3 --build-from-source
安装它"scripts": {"rebuild": "electron-rebuild -f -w sqlite3"}
"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.以上所有内容都来自某个地方的某个帖子,人们在将 sqlite3 与电子锻造结合使用时会遇到问题。 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.使用电子伪造,使用 sqlite3 运行应用程序似乎存在一些问题。 Try making sqlite3 (I am using better-sqlite3) as an external dependency in your webpack configuration.
尝试将 sqlite3(我使用的是 Better-sqlite3)作为 webpack 配置中的外部依赖项。
externals: {
'better-sqlite3': 'commonjs better-sqlite3',
},
This works in the dev environment but it fails in the build (after running make).这在开发环境中有效,但在构建中失败(在运行 make 之后)。
The better-sqlite3
won't be found in the build, since we have made it external dependency. better-sqlite3
不会在构建中找到,因为我们已经使它成为外部依赖。
Didn't get a proper solution yet.还没有得到合适的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.