npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
没有安装构建工具, 一部分依赖会需要这些工具才能正常安装, 如 better-sqlite3.
解决方法:
找到 nodejs 安装位置, 在 Windows 上是 C:\Program Files\nodejs
运行 install_tools.bat, 根据提示安装, 可能会遇到其他错误
等待安装完成, 检查是否出错, 重新运行安装命令
npm ERR! prebuild-install warn install unable to verify the first certificate
npm ERR! gyp info it worked if it ends with ok
...
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
有时可以通过更新 npm 解决.
解决方法:
在控制台底部找到类似 npm notice Run npm install -g npm@10.8.3 to update! 的信息
运行其中这样的部分: npm install -g npm@10.8.3 完成 npm 更新
重新运行安装命令
install_tools
Chocolatey upgraded 0/2 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
choco 是 windows 上的包管理器, 用来安装和管理软件. 如果一些软件通过错误的方式被卸载或者因为安装失败等原因损坏可能需要手动清理一些文件.
npm install
没有安装构建工具, 一部分依赖会需要这些工具才能正常安装, 如
better-sqlite3
.解决方法:
nodejs
安装位置, 在 Windows 上是C:\Program Files\nodejs
install_tools.bat
, 根据提示安装, 可能会遇到其他错误有时可以通过更新 npm 解决.
解决方法:
npm notice Run npm install -g npm@10.8.3 to update!
的信息npm install -g npm@10.8.3
完成 npm 更新install_tools
choco 是 windows 上的包管理器, 用来安装和管理软件. 如果一些软件通过错误的方式被卸载或者因为安装失败等原因损坏可能需要手动清理一些文件.
解决方法: (如果以前有运行过
install_tools
)C:\ProgramData\chocolatey\lib
python, python3, python312, vcredist140, vcredist2015, visualstudio2019buildtools, visualstudio2019-workload-vctools, visualstudio-installer
文件夹install_tools.bat
解决方法: (如果没用过
choco
安装软件)C:\ProgramData\chocolatey
目录install_tools.bat