由于 node-gyp 无法安装 npm:binding.gyp 未找到 [英] Cannot npm install due to node-gyp: binding.gyp not found

查看:569
本文介绍了由于 node-gyp 无法安装 npm:binding.gyp 未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一整天都在研究这个,并尝试了很多不同的东西:

  • 卸载节点并安装最新版本
  • 使用 --msvs_version= 标志设置为 2010、2011、2012、2013、2015
  • 删除 .node-gyp 文件夹
  • 向 .npmrc 添加 python 路径,如下所示:python=C:\Python27\python.exe
  • npm -g install npm@next
  • 运行node-gyp rebuildnode-gyp configure
  • 遵循Robert Kehoe 的指南

艰难时期.

该包是一个 Electron/React 应用程序,我运行的是 Windows 10.npm install 的控制台输出是

<块引用>

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(514,5): 错误 MSB8008: Specified 平台工具集 (v120) 未安装或无效.请确保支持的 PlatformToolset 值为 sel受到影响.[C:\Users\scheinerbock\Desktop\mpstudio\node_modules\mplib\build\addon.vcxproj]吉普错误!构建错误吉普错误!堆栈错误:`msbuild` 失败,退出代码:1吉普错误!堆栈在 ChildProcess.onExit (C:\Users\scheinerbock\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)吉普错误!堆栈在emitTwo (events.js:106:13)吉普错误!ChildProcess.emit 上的堆栈 (events.js:191:7)吉普错误!堆栈在 Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)吉普错误!系统 Windows_NT 10.0.14393吉普错误!命令 "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\scheinerbock\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "重建"吉普错误!cwd C:\Users\scheinerbock\Desktop\mpstudio\node_modules\mplib吉普错误!节点 -v v6.10.0吉普错误!节点-gyp -v v3.5.0吉普错误!不好

对于 node-gyp 重建:

<块引用>

gyp:在尝试加载 binding.gyp 时未找到 binding.gyp (cwd: C:\Users\scheinerbock\Desktop\mpstudio)

我对这里的驾驶室很不满意,除了解决方案之外,我希望得到任何建议或信息.

解决方案

我使用的是 macos catalina 10.15.5 并且我遇到了同样的问题,并且上述所有解决方案对我都不起作用.我能够通过运行来解决这个问题

npm i -g node-gyp@latest &&npm 配置集 node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js";

希望这对人们有所帮助.

I have been working on this all day and have tried lots of different things:

  • Uninstalling node and installing latest version
  • Using the --msvs_version= flag set to 2010, 2011, 2012, 2013, 2015
  • Deleting the .node-gyp folder
  • Adding python path to .npmrc like so: python=C:\Python27\python.exe
  • npm -g install npm@next
  • Running node-gyp rebuild and node-gyp configure
  • Following Robert Kehoe's guide

Rough times.

The package is an Electron/React app and I am running Windows 10. Console output for npm install is

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(514,5): error MSB8008: Specif
ied platform toolset (v120) is not installed or invalid. Please make sure that a supported PlatformToolset value is sel
ected. [C:\Users\scheinerbock\Desktop\mpstudio\node_modules\mplib\build\addon.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\scheinerbock\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\scheinerbock\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\scheinerbock\Desktop\mpstudio\node_modules\mplib
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok

And for node-gyp rebuild:

gyp: binding.gyp not found (cwd: C:\Users\scheinerbock\Desktop\mpstudio) while trying to load binding.gyp

I am well out of my wheelhouse here and would appreciate any suggestions or information in addition to solutions.

解决方案

I am using macos catalina 10.15.5 and i faced the same issues and all the above solutions didn't worked for me. I was able to resolve this by running

npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"

Hope this helps people.

这篇关于由于 node-gyp 无法安装 npm:binding.gyp 未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆