gpt4 book ai didi

node.js - Windows 中 Electron 的 SQLITE3 安装错误

转载 作者:行者123 更新时间:2023-12-03 12:34:03 25 4
gpt4 key购买 nike

我正在尝试将 SQLITE3 与我的 Electron 应用程序一起使用,最后使用 electron-packager 模块创建一个可执行文件。

我正在使用 --build-from-source 安装 sqlite3命令,因为 electron-rebuild没有与它一起构建 sqlite3。下面是我的 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"
}
}

我执行了 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 安装 SQLITE3

运行时,它给了我以下错误

> 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

请帮我解决这个问题

最佳答案

你应该这样尝试

"scripts": {
"postinstall": "install-app-deps"
}

关于node.js - Windows 中 Electron 的 SQLITE3 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59984512/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com