我正在尝试将 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
使用命令执行并安装 SQLITE3npm install sqlite3 --build-from-source --runtime=electron --target=7.1.10 --dist-url=https://atom.io/download/electron --python=2.7
运行时,它给了我以下错误
> 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
请帮我解决这个问题