windows - 如何在 Windows gyp 上调试 native Node 模块编译

标签 windows node.js msbuild pcap node-gyp

我正在尝试npm install Node 的pcap module在 Windows 7 上使用 Python 2.7 和 VS 2013。

为此,MSBuild 需要找到 WinPCap developer's packInclude/Lib/ 文件夹。 .

我已经尝试过these instructions通过VS2013的用户范围配置文件添加包含文件夹。这些更改肯定会被采纳(如果 XML 无效,构建过程甚至会更早终止)。

我也尝试过 AdditionalIncludeDirectories (尽管我在 MSDN docs 中找不到它),如下所示:

<PropertyGroup>
    <!-- pcap is at: c:\dev\Include\pcap\pcap.h -->
    <AdditionalIncludeDirectories>c:\dev\Include</AdditionalIncludeDirectories>
</PropertyGroup>

...但安装程序仍然提示找不到 pcap/pcap.h

我如何确定它找到这些文件? (为 MSBuild 添加一些系统(或用户)范围的包含设置真的那么困难吗?还是我只是愚蠢?)

最佳答案

好的, Visual Studio 工作得很好,有三个步骤。 首先,您需要构建带有调试符号的 Node 。

类型

$ node -v

要获取nodejs版本,请访问nodejs.org release page ,下载 tarball 并解压。

进入解压的文件夹,输入

vsbuild.bat debug nosign x64

如果成功,您将获得带有调试符号的 Debug\node.exe

其次,您需要使用 --debug 标志重新配置 node-gyp,让它生成 Visual Studio 解决方案文件。

D:\fe\mbox_electron\node_modules\example>node-gyp configure rebuild --nodedir="D:\node-v5.1.1" --debug 

第三步,也是最后一步,使用 Visual Studio 打开 sln 文件,然后配置调试参数。 enter image description here

然后就可以点击调试按钮,设置调试点,开始调试

this article has more detail

关于windows - 如何在 Windows gyp 上调试 native Node 模块编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30011886/

相关文章:

c# - ListView 跳过第一列

node.js - 无法解析 sequelize 包

javascript - Node.js 通过带有传递参数的 shell 脚本执行 python 脚本

c# - .NET Core ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor

c# - C# 文件缺少 "Line of code"

javascript - 页面更改时用声音提醒用户

Windows如何将右ctrl键用作左ctrl?

windows - 分析 Windows 进程长期 CPU 使用率的最佳方法

javascript - 使用Browserify导入平滑滚动

visual-studio - 如何在 Visual Studio/MSBuild 中进行依赖管理