更新时间:2023-12-04 12:53:10
最后,我根据@Josh提供的文章以及其他博客文章和问题讨论,找到了解决该问题的可行解决方案。下面,我写下了为解决此问题而采取的所有步骤。 最终解决方案发布在此答案的底部
Finally I found a working solution to this problem, based on article provided by @Josh, and other blog posts and issue discussions. Below I wrote all steps I have taken in order to solve this problem. The final solution is posted on the bottom of this answer
我关注了电子回购。
简单方法
我已经安装了电子重建 code>节点包并运行
./ node_modules / .bin / electron-rebuild
,这给了我以下错误:
I've installed electron-rebuild
node package and run ./node_modules/.bin/electron-rebuild
which gave me the following error:
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: Unsupported target version: 0.31.2
node-pre-gyp ERR! command "node" "/my/project/dir/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! not ok
npm ERR! Failed at the sqlite3@3.0.10 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
node-gyp方式
我已经全局安装了node-gyp模块,并输入了 ./ node_modules / sqlite3
目录。然后我尝试运行以下命令:
I've installed node-gyp module globally and entered ./node_modules/sqlite3
dir. Then I tried to run the following command:
node-gyp rebuild --target=0.31.2 --arch=x64 --dist-url=https://atom.io/download/atom-shell
并获得出现以下错误:
gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
npm方式
sqlite3叉
最后我尝试下载一些 sqlite3分支。不幸的是结果是相同的。
Finally I tried to download few of the sqlite3 forks. Unfortunately results were the same.
最终尝试-解决方案
博客@Josh提供的信息对我来说是禁止的,但我发现 Google缓存版本。我还关注了电子问题的讨论。
The blog post provided by @Josh was forbidden for me, but I found google cached version of it. I also followed the discussion of the electron issue.
下面介绍的步骤应该会为您提供一个可运行的sqlite3软件包。
Steps presented below should get you a working sqlite3 package.
电子预建: 0.29.1
电子预建
。/node_modules / sqlite3
npm运行预发布
配置node-gyp module_name和module_path
"electron-prebuilt": "0.29.1"
electron-prebuilt
./node_modules/sqlite3
npm run prepublish
Configure node-gyp module_name and module_path
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/node-v44-linux-x64
重建软件包
Rebuild package
node-gyp rebuild --target=0.29.1 --arch=x64 --target_platform=linux --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v44-linux-x64
我尝试使用0.31.2版进行编译电子预包装的包装,但由于某种原因失败。
I tried to compile using version 0.31.2 of electron-prebuilt package, but it failed for some reason.
如果您使用的是Mac,请替换 linux
使用 darwin
。
If you are using mac replace linux
with darwin
.
如果您的操作系统是32位的,请替换 x64
和 ia32
If your os architecture is 32 bit replace x64
with ia32