gyp: binding.gyp not found

环境

  • win11(MacOS 虚拟机)
  • node v20.11.1(fnm)
  • pnpm

问题描述

前端工程安装 NPM 依赖时报错 gyp: binding.gyp not found

解决方式

找到上图报错信息中的 cwd 后面的路径,我这里是:

C:\Users\guangzanwang\code\puppet-xp-getting-started\node_modules\.pnpm\[email protected]\node_modules\frida

在这个路径下创建文件 binding.gyp,并写入以下内容(sources 改成你的 NodeJS 路径):

{
    "targets": [{
        "target_name": "binding",
        "sources": [ "C:/Users/guangzanwang/AppData/Roaming/fnm/node-versions/v20.11.1/installation" ]
    }]
}

在这个目录下运行命令:

node-gyp rebuild

输出信息结尾出现这个说明构建通过了:

参考资料

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章