我如何解决错误吉普赛人 ERR! ERR! 发现 VSfind VS msvs_version 没有设置从命令行或 npm 配置?

我想运行这个项目: https://github.com/adonis-china/adonis-adminify

当我运行 npm install时,出现了错误:

> sqlite3@3.1.13 install C:\laragon\www\adonis-admin\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build


node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! gypfind VS
gyp ERR!ERR!  find VSfind VS
msvs_version not set from command line or npm config
gypgyp  ERR!ERR!  find VSfind VS msvs_version not set from command line or npm config
VCINSTALLDIR not set, not running in VS Command Prompt
gyp gypERR! ERR!  find VSfind VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp checking VS2019 (16.2.29230.47) found at:
gypERR!  find VSERR! checking VS2019 (16.2.29230.47) found at:
gyp  find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
ERR!gyp find VS ERR! "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
gypfind VS ERR! - "Visual Studio C++ core features" missing
gyp  ERR!find VS  - "Visual Studio C++ core features" missing
find VSgyp could not find a version of Visual Studio 2017 or newer to use
gypERR!  ERR!find VS  could not find a version of Visual Studio 2017 or newer to use
find VS looking for Visual Studio 2015
gyp gyp ERR!ERR!  find VSfind VS looking for Visual Studio 2015
- not found
gyp gyp ERR!ERR!  find VSfind VS - not found
not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR!gyp  ERR!find VS find VS not looking for VS2013 as it is only supported up to Node.js 8


gyp gypERR!  ERR!find VS
gypfind VS  **************************************************************
gypERR!  ERR!find VS find VS **************************************************************
You need to install the latest version of Visual Studio
gypgyp ERR!  ERR!find VS find VS You need to install the latest version of Visual Studio
including the "Desktop development with C++" workload.
gypgyp  ERR!ERR! find VS find VS including the "Desktop development with C++" workload.
For more information consult the documentation at:
gyp ERR!gyp find VS  For more information consult the documentation at:
ERR!gyp  ERR! find VSfind VS https://github.com/nodejs/node-gyp#on-windows
https://github.com/nodejs/node-gyp#on-windows
gyp gyp ERR!ERR! find VS  **************************************************************
find VSgyp **************************************************************
gypERR! find VS
ERR! find VS
gyp gypERR!  ERR!configure error
configure errorgyp
ERR! stackgyp Error: Could not find any Visual Studio installation to use
gypERR!  stackERR! Error: Could not find any Visual Studio installation to use
stackgyp      at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR!gyp stack      at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR! gypstack      at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gypERR!  ERR!stack      at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gypgyp ERR! stack     at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypERR!  ERR! stackstack     at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp gypERR!  ERR!stack stack     at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypgyp  ERR!ERR!  stackstack     at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp     at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
gyp ERR! ERR!stack     at ChildProcess.exithandler (child_process.js:301:5)
gypstack      at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
ERR! gypstack     at ChildProcess.emit (events.js:182:13)
gypERR! ERR!  stack     at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
stack     at maybeClose (internal/child_process.js:962:16)
gyp gypERR! ERR!  System Windows_NT 10.0.17134
stackgyp     at ChildProcess.exithandler (child_process.js:301:5)
ERR!gyp  commandERR! "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
gypstack     at ChildProcess.emit (events.js:182:13)
gypERR!  ERR!cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gypstack ERR!     at maybeClose (internal/child_process.js:962:16)
node -v v10.15.0
gypgyp  ERR!ERR!  Systemnode-gyp -v Windows_NT 10.0.17134
v5.0.3
gypgyp  ERR!ERR! command  "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
not okgyp
ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\laragon\www\adonis-admin\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Chelsea\AppData\Roaming\npm-cache\_logs\2019-09-10T22_53_41_072Z-debug.log

我如何解决这个错误?

213155 次浏览

DR

使用 Visual Studio Installer获取您已安装在机器上的 one of the Visual Studio versions中的 用 C + + 进行桌面开发 workload:

VS workloads

原因/详情

通读日志,主要错误是由以下原因造成的:

未从命令行或 npm 配置设置 msvs _ version

After this one you find a few of these:

“ Visual Studio C + + 核心功能”丢失

后来:

您的 需要安装最新版本的 VisualStudio包括“ Desktop development with C++”工作负载。

欲了解更多信息,请查阅以下文件:

VS https://github.com/nodejs/node-gyp#on-windows

最后:

找不到任何要使用的 VisualStudio 安装

所以要解决这个问题,您只需要得到“ 用 C + + 进行桌面开发”工作负载。

如果已安装 VisualStudio 版本

  1. 打开 VisualStudio 安装程序(Win + 搜索)
  2. 在与所有 Visual Studio 安装在您的电脑显示的列表中,按下其中一个(最好是最新版本)的 Modify按钮
  3. 工作量 grid/list 上选择带有 Desktop development with C++的复选框
  4. 安装按钮之一

gyp will then find that version and use it:

gyp info find Python using Python version 3.8.1 found at "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\python.exe"

gyp info find VS 使用 VS2019(16.4.29709.97):

gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\

没有安装 VisualStudio

以下解决方案假设您已经安装了 < em > 节点 。免责声明: 我没有测试他们中的任何一个,但是我感谢每一个报告他们解决这个问题的人。

Alternative 0: before installing additional software

作为 Kaulshapranav 写了一些评论,略微缩短/重新措辞:

Windows-build-tools 安装日志提到这个工具包已经过时,是 已经包含在节点中。它通过安装一个单独的 python 2.7(...)破坏了我的水蟒安装; 从6-> 8更新 < em > npm 版本解决了这个问题。

Npm node一起提供,因此解决方案是: 更新 node/npm版本。但是,如果您需要保留特定的版本,Nvm (注意 < strong > v )允许在它们之间进行更改: simple tutorial on how to use nvm

选择1

正如 哈米德 · 乔拉尼的回答所建议的,在 管理员 shell 上,只需在全局范围内安装构建工具包(Node-gyp 自述程序) :

npm i -g windows-build-tools

选择2

拉加万的想法/答案来自一个类似的主题:

  1. 通过运行 npm config get msvs_version验证是否有 VS 构建工具(如果有,跳到步骤4并尝试设置环境变量)
  2. 如果没有安装,get the VS build tools latest version exe和安装它(Ragavan 的想法是与或 MicrosoftBuildTools2015)
  3. 运行 npm config set msvs_version 2019 --global(或者按照 Ragavan 的想法运行 npm config set msvs_version 2015 --global)
  4. 可选项: 将 VCTargetsPath环境变量(Win + 搜索 Var)设置为适当的路径(例如 C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0)或通过 Run as Admin终端,就像 Ragavan 在2015版本工具中的想法:
    • set VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140"
    • 或者在 Powershell:

附注:

Visual Studio Installer-> 修改已安装(Visual Studio Community 2019)-> Workload (tab)-> [ x ]使用 C + + 开发桌面-> Install

Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

Full Guidance in GitHub

npm install之前使用以下命令:

npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe

\Enterprise\改成 \Community\对我来说很管用。

确保您安装了最新的 npm。

Npm install-g npm@last

我只安装了 C + + 构建工具(参考图片)通过 Visual Studio Build Tools (2019年版本)。没有其他步骤需要我赢10专业。

enter image description here

我也面临同样的问题,我所做的就是重新安装 nodejs

酷!

按照旧的答案,npm i -g windows-build-tools是一个简单而成功的答案。但是 windows-build-tools存在一个问题: https://github.com/felixrieseberg/windows-build-tools/issues/244。试试看!

为了让它与 VisualStudio2022一起工作,我必须运行:

npm config set msbuild_path "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"

我试图用 npm i -g windows-build-tools解决这个问题,但是没有成功,于是我用 c + + 工具安装了 VisualStudioBuildTools 桌面开发 最终成功地解决了这个问题

enter image description here

只需将模块 gulp-sass更新到最新版本,将 sass模块添加到 package.json 并编写

const sass = require('gulp-sass')(require('sass'));

to the gulpfile.js to get rid off node-gyp.

我这边终于解决了 here is how I did it

  1. run this command on visual studio: npm config get msvs_version( mine was saying undefined)
  2. 然后我运行 npm config set msvs_version 2022 --global(我不再看到未定义的东西)
  3. 然后运行: npm install。然后我运行我的自动化,但这次我看到(杂项警告 SELF _ SIGNED _ CERT _ IN _ CHAIN:)
  4. 然后我运行设置 NODE_TLS_REJECT_UNAUTHORIZED=0和瞧! ! ! 它是工作

我希望这有帮助。它真的很烦人,因为我的一些自动化文件不工作

I solved the issue with npm install -g node-gyp, then npm install.

首先运行这个命令(您可以编辑 VS 的年份和类型,即 2022 社区)

npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"

然后运行 npm install -g node-gyp,然后运行 npm install

确保所有这些都在项目内完成。enter image description here

试试看

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

这招对我很管用。

我修复了安装 vscode 2017和桌面开发与 C + + (IM 安装默认选择下载。不确定是否选择默认选项 看到影像。 将错误或不)与 vsInstaller 和设置(请设置与 VS 2017的开发人员命令提示符) < em > 使用命令与您的目录项目不全局示例: cd“ G: work projectA”

  1. 通过命令设置 Msbuild _ path: Npm 配置设置 MSBuild _ path“ G: vs 2017 MSBuild 15.0 Bin MSBuild.exe” (由于我的 c 驱动器已满,因此通过启动对驱动器 G 进行 IM 设置)
  2. 通过命令设置 Msvs _ version: Npm 配置集 msvs _ version 2017 (在 IM 使用2015之前无法工作)
  3. 通过命令 node-gyp configure if not err. congat you can use npm install now

注意: 您可以通过 npm config get ....检查本地值

如果您仍然面临安装 Windows 生成的问题 您也可以手动安装它,而无需使用命令提示符。

你可以通过官方网站或这里安装 Windows 构建工具。

1: Windows Build Tool Complete Package : Here

2 : 官方网站下载: < a href = “ https://www.microsoft.com/en-in/download/Details s.aspx? id = 48159”rel = “ nofollow noReferrer”> 这里

我也遇到了同样的问题,不知道该怎么办。我搜索了整个网络,仍然没有解决方案。 我决定这么做

npm outdated

当您尝试这个命令时,您将基本上看到所有的版本,并且您将详细了解需要哪个版本,哪个是当时的最新版本,以及您的项目 json 文件具有哪个版本。

C:\GitHub\portfolio>npm outdated
Package                          Current  Wanted  Latest  Location                                      Depended by
babel-plugin-styled-components    1.13.3  1.13.3   2.0.7  node_modules/babel-plugin-styled-components   portfolio
babel-preset-gatsby               1.14.0  1.14.0  2.21.0  node_modules/babel-preset-gatsby              portfolio
eslint                            7.32.0  7.32.0  8.22.0  node_modules/eslint                           portfolio
gatsby                            3.14.6  3.14.6  4.21.1  node_modules/gatsby                           portfolio
gatsby-plugin-google-analytics    3.14.0  3.14.0  4.21.0  node_modules/gatsby-plugin-google-analytics   portfolio
gatsby-plugin-image               1.14.2  1.14.2  2.21.0  node_modules/gatsby-plugin-image              portfolio
gatsby-plugin-netlify             2.11.1  2.11.1   5.0.1  node_modules/gatsby-plugin-netlify            portfolio
gatsby-plugin-offline             3.10.2  3.10.2  5.21.0  node_modules/gatsby-plugin-offline            portfolio
gatsby-plugin-react-helmet        3.10.0  3.10.0  5.21.0  node_modules/gatsby-plugin-react-helmet       portfolio
gatsby-plugin-sitemap             2.12.0  2.12.0  5.21.0  node_modules/gatsby-plugin-sitemap            portfolio
gatsby-plugin-styled-components   3.10.0  3.10.0  5.21.0  node_modules/gatsby-plugin-styled-components  portfolio
gatsby-remark-prismjs             3.13.0  3.13.0  6.21.0  node_modules/gatsby-remark-prismjs            portfolio
gatsby-transformer-remark         4.11.0  4.11.0  5.21.0  node_modules/gatsby-transformer-remark        portfolio
husky                              6.0.0   6.0.0   8.0.1  node_modules/husky                            portfolio
lint-staged                       10.5.4  10.5.4  13.0.3  node_modules/lint-staged                      portfolio
react                             17.0.2  17.0.2  18.2.0  node_modules/react                            portfolio
react-dom                         17.0.2  17.0.2  18.2.0  node_modules/react-dom                        portfolio

Then after I figure out all reds to yellow, all the packages are installed and ready to use.

现在再试一次。

Worked for me; it should work for you too.

如果上述所有方法都没有帮助,请验证命令提示符不是自定义的

例如,如果你正在使用微软视窗系统,并且在启动时使用 doskey 来添加别名。 如果发生这种情况,查找 VisualStudio 安装的工具就会混淆。

您可以通过手动打开一个新的命令提示符并验证它具有最少的输出来测试是否是这种情况,例如

微软视窗..。 (c) ...

$路径 >