繁体   English   中英

运行 npm install 时出错(未找到 Visual Studio)

[英]Error running npm install (Visual Studio not found)

当我尝试在此 Node.js 项目上运行 npm install 时,我收到以下错误:

pm 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 2022
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
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
npm ERR! gyp ERR! find VS valid versions for msvs_version:
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

我已经安装了 Visual Studio Community,使用 C++ 工作负载和 node-gyp 进行桌面开发,但似乎没有任何效果。 另外,我重新安装了 Node.js 和 Python。 我怎样才能解决这个问题?

您正在为 node-gyp 运行什么版本?

我注意到您遇到此错误“未设置 VS VCINSTALLDIR,未在 VS 命令提示符中运行”

这是关于该错误的线程/ https://github.com/nodejs/node-gyp/issues/2552

特别是来自线程的此评论可能会修复您的错误“酷。在 cmd 中,键入 SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\ 就像他们在https://stackoverflow.com/questions中所做的一样/1679560/using-visual-studio-command-prompt-tools-everywhere"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM