我正在尝试运行 API。我收到这个错误。我已经卸载了节点模块,重新安装,npm 重建。我尝试安装 memwatch 但也出现错误。我尝试过所有类型的重新启动和重新启动。 我必须在这个项目中使用 Node 8.11.1,所以我无法更改版本。这是完整的错误:
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at _errnoException (util.js:1022:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:372:16)
gyp ERR! stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:180:9)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jackc\Documents\GitHub\blacqmarket\api\node_modules\memwatch-next
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] 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\jackc\AppData\Roaming\npm-cache\_logs\2021-07-09T11_35_46_516Z-debug.log
老版本的 npm 似乎有问题,你可以先尝试一下
npm install -g npm@latest
,如果这不起作用或者你无法升级你的 Node.js 版本,请尝试这样做
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" -g
我在 Windows 11 上遇到以下错误:
NPM:
npm 错误!吉普 错误!堆栈错误:生成 C:\Program Files (x86)\Microsoft Visual Studio�9\BuildTools\MSBuild .0\Bin\MSBuild.exe ENOENT
视觉工作室:
生成 C:\Program Files (x86)\Microsoft Visual Studio�9\BuildTools\MSBuild .0\Bin\MSBuild.exe ENOENT
对于使用 BuildTools 2019 和 Windows 11 的我来说,此配置是正确的:
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" -g
就我而言,在 Windows 11 上唯一有效的方法是手动指定构建路径(使用您的):
npm install hnswlib-node --msbuild_path="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
如果您的计算机上没有此文件:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
尝试使用问题中的链接安装正确版本的
MSBuild.exe
:Visual Studio 2017 构建工具仍然可供下载吗?:
如果此后您遇到另一个错误,例如
The imported project "X:\Microsoft.Cpp.Default.props" was not found.
,请尝试以下命令:
npm config set msvs_version 2019