getdns-node
getdns-node copied to clipboard
Fails to install due to a compilation error
The module fails to install with the following error:
$ node -v
v7.10.1
$ npm install --save getdns
> [email protected] install /Users/test/projects/test-getdnsapi/node_modules/getdns
> npm run --silent rebuild
CXX(target) Release/obj.target/getdns/src/GNContext.o
In file included from ../src/GNContext.cpp:28:
../src/GNContext.h:33:10: fatal error: 'getdns/getdns.h' file not found
#include <getdns/getdns.h>
^
1 error generated.
make: *** [Release/obj.target/getdns/src/GNContext.o] Error 1
I also tried with Node 6 and Node 9 and the result is the same. My machine is MacOS High Sierra, version 10.13.1 (17B1002)
Oh, it actually needs getdns
C library to be installed manually before? If so, isn't it possible this to be done automatically? I'm not sure if any dev will be OK to do it and how maintainable will be it.
It does. There is a brew formula for it too? But maybe it is worth investigating to have the C library embedded somehow (maybe in a git submodule?) too...
I think without this the module is practically unusable. I can't force all people in the team who use Mac, Linux and Windows to install the library manually before installing the Node module, neither to tell people who make Docker image to do it too.
All the dependencies has to install transparently - the developer should only do: npm install --save getdns
Acknowledged. I'll have a go at it (but not very soon, cause I'm very busy currently)
@ipeychev: simplifying the installation would indeed be great! Am too used to having getdns and dependencies installed already, didn't think much about bundling.
@wtoorop: I am generally against git submodules, especially if npm
would need to invoke it during build/deployment on production servers/containers etcetera.
Perhaps the node-sqlite3
approach to bundle and unpack the library source code can be applied? Then node-gyp
would need to know the (temporary) unpacked location. It might also help (a lot) to bundle external libraries used by getdns. (If bundling and building gets too messy, I would consider putting it in a separate repository.)
It also looks like node-pre-gyp might be useful.