Jaw*_*qib 3 node.js node-gyp electron electron-rebuild
我正在尝试使用 Sqlite3 重建我的 ElectronJS 应用程序,我已经安装了 Python、VS 开发工具,但它仍然给我错误: My Package.json:
{
"name": "hello",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron .",
"rebuild": "electron-rebuild -f -w sqlite3",
"postinstall": "electron-builder install-app-deps"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron": "^8.2.1",
"sqlite3": "^4.1.1"
},
"devDependencies": {
"electron-rebuild": "^1.10.1"
}
}
Run Code Online (Sandbox Code Playgroud)
要使用电子重建,它提到了以下要求;
有什么要求?需要节点 v6.0.0 或更高版本。从源代码使用构建本机模块
node-gyp,请参阅链接了解其安装/运行时要求。
您需要安装 gyp(它将由 electro-rebuild 安装)并配置操作系统的构建工具。这是文档中提到的 Windows 构建选项
在 Windows 上
从 Microsoft Store 软件包安装当前版本的 Python。
选项 1使用 Microsoft 的 windows-build-tools 从提升的 PowerShell 或 CMD.exe(以管理员身份运行)中使用 npm install --global --product windows-build-tools 安装所有必需的工具和配置。
选项 2手动安装工具和配置:
安装 Visual C++ 构建环境:Visual Studio 构建工具(使用“Visual C++ 构建工具”工作负载)或 Visual Studio 2017 Community(使用“C++ 桌面开发”工作负载)启动 cmd,npm config set msvs_version 2017 如果上述步骤没有如果不适合您,请访问 Microsoft 的 Windows Node.js 指南以获取更多提示。
若要在 ARM 上的 Windows 10 上以本机 ARM64 Node.js 为目标,请添加组件“适用于 ARM64 的 Visual C++ 编译器和库”和“适用于 ARM64 的 Visual C++ ATL”。