简体   繁体   English

homebrew node.js开发

[英]homebrew node.js devel

I have successfully installed node.js using homebrew . 我已经使用homebrew成功安装了node.js。 But homebrew did not create the include directory for all *.h files from node.js & v8. 但是自制软件没有为node.js和v8中的所有* .h文件创建include目录。 I then tried running brew install --devel node without any luck. 然后,我尝试运行brew install --devel node但没有任何运气。

Is there any way to install node via homebrew and have all the include files from node? 有什么方法可以通过自制程序安装节点,并从节点获取所有包含文件? I am creating a C++ addon for node.js so need all header files. 我正在为node.js创建一个C ++插件,因此需要所有头文件。

All you should need is the node executable and node-gyp for compiling. 您需要做的只是node可执行文件和node-gyp进行编译。

You can read up on both of these in the C/C++ Addons documentation: 您可以在C / C ++插件文档中阅读这两种信息:

Node statically compiles all its dependencies into the executable. Node将所有依赖项静态编译为可执行文件。 When compiling your module, you don't need to worry about linking to any of these libraries. 编译模块时,无需担心链接到任何这些库。

The source code needs to be built into hello.node , the binary Addon. 源代码需要内置到二进制Addon的hello.node To do this we create a file called binding.gyp which describes the configuration to build your module in a JSON-like format. 为此,我们创建一个名为binding.gyp的文件,该文件描述了以类似JSON格式构建模块的配置。 This file gets compiled by node-gyp . 该文件由node-gyp编译。

 { "targets": [ { "target_name": "hello", "sources": [ "hello.cc" ] } ] } 

There are a few introductory examples covered, and each can be found as well in rvagg's node-addon-examples . 这里介绍了一些入门示例,每个示例也可以在rvagg的node-addon-examples中找到

Though, you'll have to read up on V8 and libuv separately ( libuv book ). 但是,您必须分别阅读V8libuvlibuv书 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM