[英]SQLITE3 installation error for Electron in Windows
I am trying to use SQLITE3 with my Electron app and finally create an executable file using electron-packager module.我正在尝试将 SQLITE3 与我的 Electron 应用程序一起使用,并最终使用 electron-packager 模块创建一个可执行文件。
I am installing sqlite3 using --build-from-source
command, since electron-rebuild
is not building the sqlite3 along with it.我正在使用--build-from-source
命令安装 sqlite3,因为electron-rebuild
没有同时构建 sqlite3。 Below is my package.json下面是我的 package.json
{
"name": "dashboard",
"version": "1.0.0",
"main": "app/main.js",
"scripts": {
"start": "electron .",
"package-win": "electron-packager . --overwrite --platform=win32 --arch=ia32 --icon=icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Serum Dashboard\""
},
"author": "Amar Shah",
"license": "ISC",
"dependencies": {
"sqlite3": "^4.1.1"
},
"devDependencies": {
"electron": "^7.1.10",
"electron-packager": "^14.2.0"
}
}
I executed the windows-build-tools
and installing SQLITE3 using command npm install sqlite3 --build-from-source --runtime=electron --target=7.1.10 --dist-url=https://atom.io/download/electron --python=2.7
我执行了windows-build-tools
并使用命令npm install sqlite3 --build-from-source --runtime=electron --target=7.1.10 --dist-url=https://atom.io/download/electron --python=2.7
While running, its giving me below error运行时,它给了我以下错误
> sqlite3@4.1.1 install C:\serum-dashboard\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
unpack_sqlite_dep
'2.7' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code 1. [C:\serum-dashboard\node_modules\
sqlite3\build\deps\action_before_build.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\serum-dashboard\\node_modules\\sqlite3\\lib\\binding\\electron-v7.1-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\serum-dashboard\\node_modules\\sqlite3\\lib\\binding\\electron-v7.1-win32-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v7.1"
gyp ERR! cwd C:\serum-dashboard\node_modules\sqlite3
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
Please help me out to solve this issue请帮我解决这个问题
You should try like this way你应该像这样尝试
"scripts": {
"postinstall": "install-app-deps"
}
I was getting this error unpack_sqlite_dep 'Python2.7' is not recognized as an internal or external command
.我收到此错误unpack_sqlite_dep 'Python2.7' is not recognized as an internal or external command
。
I had Python installed, and had it in the path.我安装了 Python,并将它放在路径中。
I also had the MS build tools installed, but in node there was a config setting to use a different version of the build tools than I had - I have 2017 and now 2019 but in the npm config file it was set to use 2015.我还安装了 MS 构建工具,但在 node 中有一个配置设置来使用与我不同版本的构建工具 - 我有 2017 年和现在 2019 年,但在 npm 配置文件中它被设置为使用 2015 年。
this is what I had in global npm config found in AppData\\Roaming\\npm\\etc
:这是我在AppData\\Roaming\\npm\\etc
找到的全局 npm 配置中的内容:
python=python3.9蟒蛇=蟒蛇3.9
msvs_version=2015 msvs_version=2015
there is also another local place for that in your user folder.在您的用户文件夹中还有另一个本地位置。 I removed the python and msvs sections from both those files and now it works.我从这两个文件中删除了 python 和 msvs 部分,现在它可以工作了。
Helpful command to see what is in your npm config: npm config list
查看 npm 配置中的内容的有用命令: npm config list
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.