电子重建中发生未处理的错误

An unhandled error occurred inside electron-rebuild

我正在尝试用 Sqlite3 重建我的 ElectronJS 应用程序,我已经安装了 Python、VS 开发工具,但它仍然给我错误: 我的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"
  }
}

这是我面临的错误:

要使用 electron-rebuild 它提到了以下要求;

What are the requirements? Node v6.0.0 or higher is required. Building the native modules from source uses node-gyp, refer to the link for its installation/runtime requirements.

你需要install gyp(它会被electron-rebuild安装) 和 configure the build 操作系统工具。这是文档

中提到的 windows 的构建选项

On Windows

Install the current version of Python from the Microsoft Store package.

Option 1 Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

Option 2 Install tools and configuration manually:

Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" workload) or Visual Studio 2017 Community (using the "Desktop development with C++" workload) Launch cmd, npm config set msvs_version 2017 If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.

To target native ARM64 Node.js on Windows 10 on ARM, add the components "Visual C++ compilers and libraries for ARM64" and "Visual C++ ATL for ARM64".

尝试将您的 sqlite3 版本升级到 v5.0.0

这里是对同一个错误的更详细的解释

  "dependencies": {
    "sqlite3": "^5.0.0"
  }