首页 > 解决方案 > NodeJS headers on Windows are not installed automatically

问题描述

I have used NodeJS installers from the official site https://nodejs.org/en/. For Linux it is just an archive and for Windows it is a .msi file.

The problem is that on Linux the unpacked archive contains include/node directory with uv.h, v8.h and most other famous headers, but on Windows the include directory does not appear after the installation with .msi.

I tried to use the command "npm install node-gyp", but it did not install the headers. After more deep googling I found that many people somehow have C:\Users\UserName\.node-gyp directory with all headers there, but I don't have it.

Questions:

P. S: Also found that some people get it by "git clone https://github.com/nodejs/node". Really I should use this ugly way and copy manually the headers from the cloned project into my home?? I supposed, .msi or "npm install node-gyp" should do all the job.

标签: node.jsnode-gyp

解决方案


使用“git clone”-ed“node\deps”中的标头的解决方法有效。但是,几天后我找到了运行命令的正确解决方案

node-gyp configure

这个命令在日志中给我写了一些有趣的输出:

gyp http GET https://nodejs.org/dist/v8.11.3/node-v8.11.3-headers.tar.gz

因此,标题实际上可以在官方网站https://nodejs.org/en/download/上找到,但努力隐藏在页面下方的“所有下载选项”菜单项中。

最后,“node-gyp configure”创建了著名的目录 C:\Users\UserName\.node-gyp\xxx,其中包含“include\node”子目录,下载的头文件以正确的结构放置在那里。


推荐阅读