运行环境
1. node16
2. electron22
3. vue3
4 windows 11
问题描述
前端项目中添加了sqlite3的依赖后报错:
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: XXXXX\node_modules\sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@16.15.0 | win32 | x64
node-pre-gyp info check checked for “xxxxx\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node” (not found)
…
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
截图如下:
解决办法
-
安装windows-build-tools
npm install --g --production windows-build-tools
-
删掉lock文件、node_modules重新执行npm install / yarn 安装依赖
npm install