海河梅西 2022-05-03 13:22 采纳率: 100%
浏览 466
已结题

vue安装heatmap插件报错“Could not find any Visual Studio installation to use”

问题遇到的现象和发生背景

想在vue中安装heatmap绘制热力图,已经安装了visual studio 2022社区版并勾选了使用c++的桌面开发,但仍报错“ gyp ERR! stack Error: Could not find any Visual Studio installation to use”
其中一条报错内容为unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
(引号中是我的安装路径)

问题相关代码
npm install heatmap

运行结果及报错内容
E:\web\pipe-project\pipe-project>npm install heatmap
npm ERR! code 1
npm ERR! path E:\web\pipe-project\pipe-project\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.3.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.8.3 found at "D:\python\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 installed in "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE"
npm ERR! gyp ERR! find VS running in VS Command Prompt, installation path is:
npm ERR! gyp ERR! find VS "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2022\Visual Studio Tools"
npm ERR! gyp ERR! find VS - will only use this version
npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
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 msvs_version does not match this VS Command Prompt or the
npm ERR! gyp ERR! find VS installation cannot be used.
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 **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:3
51:14)
npm ERR! gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:333:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "E:\\nodejs\\node.exe" "E:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\web\pipe-project\pipe-project\node_modules\canvas
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok


我的解答思路和尝试过的方法
  1. 设置使用路径
    npm config set msvs_version “C:\Program Files\Microsoft Visual Studio\2022\Community”,无效,仍然报错unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
  2. 执行
npm install -g node-gyp

以及

npm i -g windows-build-tools

仍然无效,报错信息不变。我的主要疑问在于为什么已经安装了visual studio,却还报错unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community",最终导致找不到visual studio呢,期待各位高人的解答指点,谢谢!

  • 写回答

2条回答 默认 最新

  • 小蓝阿姨 2022-05-03 13:44
    关注

    你的nodejs是什么版本

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 5月11日
  • 已采纳回答 5月3日
  • 创建了问题 5月3日

悬赏问题

  • ¥15 MddBootstrapInitialize2失败
  • ¥15 LCD Flicker
  • ¥15 Spring MVC项目,访问不到相应的控制器方法
  • ¥15 esp32在micropython环境下使用ssl/tls连接mqtt服务器出现以下报错Connected on 192.168.154.223发生意外错误: 5无法连接到 MQTT 代理,如何解决?
  • ¥15 关于#genesiscsheel#的问题,如何解决?
  • ¥15 Android aidl for hal
  • ¥15 STM32CubeIDE下载程序报错
  • ¥15 微信好友如何转变为会员系统?(相关搜索:小程序)
  • ¥15 c# 直接使用c++ 类库文件
  • ¥15 一个主机电脑有两个显示器,当前有两个软件主体是网页html打包的exe程序,如何通过cmd命令bat同时打开软件一个在主屏幕显示,另外一个软件在2副屏幕上显示