简体   繁体   中英

homebrew node.js devel

I have successfully installed node.js using homebrew . But homebrew did not create the include directory for all *.h files from node.js & v8. I then tried running brew install --devel node without any luck.

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.

All you should need is the node executable and node-gyp for compiling.

You can read up on both of these in the C/C++ Addons documentation:

Node statically compiles all its dependencies into the executable. 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. To do this we create a file called binding.gyp which describes the configuration to build your module in a JSON-like format. This file gets compiled by 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 .

Though, you'll have to read up on V8 and libuv separately ( libuv book ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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