第一种方案

管理员运行 CMD (Power Shell 也行)
执行更新工具集

npm install --global --production windows-build-tools

第二种方案

它会提示你当然 GYP 的vs 版本不匹配,会不断的递增去查询
执行设置指定 sdk 版本

npm config set msvs_version 2019
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.1.0
npm ERR! gyp info using node@16.4.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at "C:\Users\l\AppData\Local\Programs\Python\Python39\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2015
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.10.31515.178) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v142
npm ERR! gyp ERR! find VS - found Windows SDK: 10.0.19041.0
npm ERR! gyp ERR! find VS - msvs_version does not match this version
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! gyp ERR! find VS - "2019"
npm ERR! gyp ERR! find VS - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************

都是相对比较基础性的问题,Node最多的就是版本问题,太多版本,太容易出错了,稍微多看看 【警告、错误】提示就能解决问题。

持续记录一下个人所遇到的问题

npm错误 gyp错误 vs版本不对msvs_version 不兼容 windows SDK 报错执行更新GYP 语句第一种方案第二种方案执行更新GYP 语句npm install -g node-gyp最新的GYP 好像已经不支持Python 2.7 版本,npm 会提示你 更新都3.*.*版本安装 Node.js 的时候一定要勾选 以下这个 , 会自动检测安装缺少的环境第一种方案管理员运行 CMD (Power Shell 也行)执行更新工具集npm install --glo
最近新装了MacOS的最新版10.15,重新安装开发环境,nodejs安装的是最新的,再用npm 安装包时总会报 gyp ERR! 错 gyp ERR! configure error  gyp ERR! stack Error: EACCES: permission denied, mkdir  解决方法,在命令后加上–unsafe-perm sudo npm install vue –unsafe-perm 该命令的相关官方文档地址:https://docs.npmjs.com/misc/config#unsafe-perm  npm 出于安全考虑不支持以 root 用户运行,即使
npm ERR! path D:\demo\node_modules\node-sass npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js npm ERR! Building: C:\Pr... isNodeGypPackage(path) 返回一个Promise,该Promise根据path的包是否具有binding.gyp文件而解析为true或false 。 defaultGypInstallScript 具有默认字符串的字符串,应将其用作node-gyp软件包的install脚本。 > node-gyp rebuild No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'. No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'. No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'. gyp: No Xcode or CLT version detected! gyp E 4.然后就报出如下错误 localhost:react-first changwei$ npm install --save react-router npm WARN deprecated core-js@1.2.7: core-js@ fsevents@1.2.4 install /Users/changwei/project/react-first/node_modules/fsevents > node in 这个错误通常是由于缺少 Visual Studio版本信息导致的。可以通过以下方法解决: 1. 确保已经安装了最新版本Visual Studio,并且已经添加到了系统环境变量中。 2. 如果已经安装了 Visual Studio 但还是无法解决问题,可以尝试在命令行中设置 msvs_version 参数。例如: npm config set msvs_version 2017 这里将 msvs_version 设置为 2017,你可以根据自己的实际情况设置。 3. 如果以上方法都无法解决问题,可以尝试升级 Node.js 版本,或者使用其他版本Node.js。有些 Node.js 版本可能会与某些 Visual Studio 版本不兼容,会导致出现这个错误。 希望这些方法可以帮助你解决问题。 ### 回答2: gyp ERR!find VS msvs_version not set from command line or npm config错误是在使用npm安装依赖包时出现的。这个错误通常是因为系统缺少Visual Studio的相关组件或者没有正确设置msvs_version的值。 要解决这个问题,可以尝试以下步骤: 1. 确保系统已经安装了Visual Studio以及相关的C++组件。如果没有安装,可以前往Microsoft官方网站下载并安装Visual Studio。 2. 如果已经安装了Visual Studio,可以打开Visual Studio的开发人员命令提示符,然后运行npm安装命令。这样可以确保相关的环境变量和配置已经设置正确。 3. 可以尝试在运行npm安装命令时添加msvs_version的参数,例如: npm install --msvs_version=2017 4. 另外,你也可以在npm的配置文件中设置msvs_version的值。可以通过以下命令查看npm的配置文件位置: npm config get userconfig 打开该文件,修改或添加msvs_version的值为你系统中已经安装的Visual Studio版本,例如: msvs_version=2017 5. 如果以上步骤均无效,可以尝试卸载并重新安装Node.js和npm,并确保安装的版本是最新的。 总结来说,gyp ERR!find VS msvs_version not set from command line or npm config错误是由于缺少Visual Studio组件或者没有正确设置msvs_version的值导致的。通过安装Visual Studio、检查环境变量和配置、添加参数或设置配置文件中的msvs_version值等方式,可以解决这个问题。 ### 回答3: gyp ERR! find VS msvs_version not set from command line or npm config 是一个错误信息,通常出现在使用Node.js的项目中,涉及到使用了某些需要编译的模块或插件。 这个错误的意思是在执行npm install命令时,系统无法找到VS版本信息。VS代表Visual Studio,也就是缺少了Visual Studio版本设置。它可能是由于没有正确配置或设置npm或命令行环境变量导致的。 要解决这个错误,有几个可能的方案: 1. 检查是否已经安装了Visual Studio或者Windows SDK。如果没有,可以从Microsoft的官方网站下载并安装适合您系统版本Visual Studio或Windows SDK。 2. 如果已经安装了Visual Studio或Windows SDK,可以尝试通过在命令行中设置msvs_version来解决问题。例如,您可以执行以下命令来设置msvs_version为所需的版本npm config set msvs_version 2017。在此示例中,将msvs_version设置为2017年版本。 3. 可以尝试执行npm config edit命令,打开npm配置文件,查找msvs_version并确保已设置为所需的版本。如果没有找到,可以手动添加msvs_version字段并设置为所需的版本。 请注意,具体的解决方案可能因个人计算机环境的不同而有所差异。在解决问题时,根据错误信息和个人实际情况进行相应的调整和尝试。
CSDN-Ada助手: 非常感谢您分享这篇关于Nuxt3项目集成Element Plus的博客,这对于我们学习和掌握Nuxt3技术,以及更好地使用Element Plus组件库都有很大的帮助。恭喜您已经写了第7篇博客,持续创作非常值得赞扬。希望您能够继续分享更多关于前端开发的知识和经验,并且可以结合实际项目经验给出更多的建议和技巧。期待您的下一篇博客! CSDN 会根据你创作的博客的质量,给予优秀的博主博客红包奖励。请关注 https://bbs.csdn.net/forums/csdnnews?typeId=116148&utm_source=csdn_ai_ada_blog_reply7 看奖励名单。 npm错误 gyp错误 vs版本不对 msvs_version不兼容 门前有两棵树,一棵是枣树,另一棵还是枣树