node.js - 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:
- How to install the "complete" (containing headers) node-gyp on Windows?
- Why "npm install node-gyp" does not do it?
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.
解决方案
使用“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”子目录,下载的头文件以正确的结构放置在那里。
推荐阅读
- javascript - 如何从嵌套的 Javascript 数组中读取数据
- php - git避免在发生合并冲突时使用FTP上传文件
- excel - 工作簿表复制到多个工作簿并重命名
- netsuite - NetSuite:从 Suitecommerce 站点获取信息到用户事件脚本
- ios - 在另一个 View Xcode 中显示 ViewController
- c# - PDFClown 无法编辑创建的 PDF
- scala - 具有树结构的 Akka 流
- javascript - 无法在 XmlHttpRequest 中分配“Access-Control-Allow-Origin”
- dart - 有什么方法可以在颤振中创建 3D 图表
- ios - 在 ARKit 中何时使用 worldTransform() 以及何时使用 transform()