gpt4 book ai didi

node.js - 吉普错误!构建错误 - 如果未定义 npm_config_node_gyp

转载 作者:行者123 更新时间:2023-12-05 06:58:35 24 4
gpt4 key购买 nike

在我运行“npm install”后出现这些错误,我运行了“npm install --g --production windows-build-tools”,我还删除了 node_modules、package-lock.json并安装了 Visual Studio community 2019 但仍然有同样的问题......

enter image description here enter image description here enter image description here

C:\Users\myuser\Documents\GitHub\myRepo\node_modules\snappy> if not defined npm_config_node_gyp
"C:\Users\myuser\Documents\GitHub\myRepo\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )
else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.7.30621.155) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - missing any VC++ toolset
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp ERR! find VS - could not find MSBuild in registry for this version
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:20
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:315:5)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1047:16)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Users\myuser\Documents\GitHub\myRepo\node_modules\\node_modules\\node\\bin\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\myuser\Documents\GitHub\myRepo\node_modules\snappy
gyp ERR! node -v v14.10.1
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok

我使用的 Nodejs 版本是:v12.8.1 和NPM版本:6.10.2

运行“npm install”后,我应该怎么做才能消除该错误?

最佳答案

我建议在管理模式下使用 power-shell 命令安装依赖项 npm install --global windows-build-tools

关于node.js - 吉普错误!构建错误 - 如果未定义 npm_config_node_gyp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64578469/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com