安装sqlite3报错找不到c++/python/nodegyp错误,electron-vite,下载Visual Studio,配置vc环境变量

复制代码
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm warn deprecated npmlog@6.0.2: This package is no longer supported.
npm warn deprecated are-we-there-yet@3.0.1: This package is no longer supported.
npm warn deprecated gauge@4.0.4: This package is no longer supported.
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '\\\\?\\E:\\mysctrip\\book-write\\front_electron_book\\node_modules\\node-gyp\\node_modules',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\node_modules'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'E:\\mysctrip\\book-write\\front_electron_book\\node_modules\\node-gyp\\node_modules'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path E:\mysctrip\book-write\front_electron_book\node_modules\sqlite3
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install -r napi || node-gyp rebuild
npm error prebuild-install warn install read ECONNRESET
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@8.4.1
npm error gyp info using node@22.21.1 | win32 | x64
npm error (node:11168) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.12.6 found at "D:\python\python.exe"
npm error gyp ERR! find VS
npm error gyp ERR! find VS msvs_version not set from command line or npm config
npm error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm error gyp ERR! find VS checking VS2022 (17.13.35931.197) found at:
npm error gyp ERR! find VS "D:\Visual Studio"
npm error gyp ERR! find VS - found "Visual Studio C++ core features"
npm error gyp ERR! find VS - found VC++ toolset: v143
npm error gyp ERR! find VS - missing any Windows SDK
npm error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm error gyp ERR! find VS looking for Visual Studio 2015
npm error gyp ERR! find VS - not found
npm error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm error gyp ERR! find VS
npm error gyp ERR! find VS **************************************************************
npm error gyp ERR! find VS You need to install the latest version of Visual Studio
npm error gyp ERR! find VS including the "Desktop development with C++" workload.
npm error gyp ERR! find VS For more information consult the documentation at:
npm error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm error gyp ERR! find VS **************************************************************
npm error gyp ERR! find VS
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm error gyp ERR! stack     at VisualStudioFinder.fail (E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm error gyp ERR! stack     at E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm error gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm error gyp ERR! stack     at E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm error gyp ERR! stack     at E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm error gyp ERR! stack     at E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\util.js:54:7
npm error gyp ERR! stack     at E:\mysctrip\book-write\front_electron_book\node_modules\node-gyp\lib\util.js:33:16
npm error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:424:5)
npm error gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
npm error gyp ERR! stack     at maybeClose (node:internal/child_process:1101:16)
npm error gyp ERR! System Windows_NT 10.0.26200
npm error gyp ERR! command "C:\\nvm4w\\nodejs\\node.exe" "E:\\mysctrip\\book-write\\front_electron_book\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd E:\mysctrip\book-write\front_electron_book\node_modules\sqlite3
npm error gyp ERR! node -v v22.21.1
npm error gyp ERR! node-gyp -v v8.4.1
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: C:\Users\libai\AppData\Local\npm-cache\_logs\2025-12-26T11_30_31_176Z-debug-0.log

主要是

npm error gyp ERR! command "C:\\nvm4w\\nodejs\\node.exe" "E:\\mysctrip\\book-write\\front_electron_book\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

npm error gyp ERR! find VS - found "Visual Studio C++ core features"

npm error gyp ERR! find VS - found VC++ toolset: v143 npm error gyp ERR! find VS - missing any Windows SDK npm error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use

npm error gyp ERR! find VS including the "Desktop development with C++" workload.

关于Visual Studio 构建工具缺了或者没找到

先去这个网站https://visualstudio.microsoft.com/zh-hans/downloads/#build-tools-for-visual-studio-2022

下载下载器,看一下有没有安装,安装的全不全,少的就下载,不新的更新,c++桌面组和window-sdk是必选的,选好后下载,可以在安装位置题签中自定义安装位置,和是不是要缓存

当都下载完了,确定下载路径中有还是报错,配置一下环境变量

在刚刚Visual Studio下载的文件夹下找到

VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64

还不行可能是python没装或者node版本不够高,装python配个环境变量,升级一下node

相关推荐
None3212 天前
【NestJs】使用Winston+ELK分布式链路追踪日志采集
javascript·node.js
Dilettante2582 天前
这一招让 Node 后端服务启动速度提升 75%!
typescript·node.js
Mr_li2 天前
NestJS 集成 TypeORM 的最优解
node.js·nestjs
UIUV2 天前
node:child_process spawn 模块学习笔记
javascript·后端·node.js
前端付豪3 天前
Nest 项目小实践之注册登陆
前端·node.js·nestjs
天蓝色的鱼鱼3 天前
Node.js 中间层退潮:从“前端救星”到“成本噩梦”
前端·架构·node.js
codingWhat3 天前
uniapp 多地区、多平台、多环境打包方案
前端·架构·node.js
小p4 天前
nodejs学习: 服务器资源CPU、内存、硬盘
node.js
Mr_li4 天前
手摸手,教你如何优雅的书写 NestJS 服务配置
node.js·nestjs
百锦再4 天前
Django实现接口token检测的实现方案
数据库·python·django·sqlite·flask·fastapi·pip