Skip to content
Leroy Witteveen edited this page Sep 16, 2016 · 6 revisions

Frequently Ask Questions about node-pre-gyp

Is my node-pre-gyp packaged binary going to work on other platforms?

Yes, it is very likely that any binaries you build and package with node-pre-gyp will work flawlessly on all platforms.

However, of course there are a few important gotchas that must be considered:

Windows

On Windows for Node C++ modules that do not link external libraries there are no major gotchas. The binaries you build will work well on any Windows system. This is because the default linking for Node is /MT (aka RuntimeLibrary:0) and node-pre-gyp modules inherit this setting by default. So, the C++ runtime will be statically linked into the addon binary and therefore you don't need to worry about your users installing it separately.

However, for Node C++ modules on Windows that depend on external shared libraries, you'll need to understand whether those libraries were linked with /MD or /MT. If the external DLL was linked with /MD then you'll likely need to also link your Node C++ addon using /MD and you'll need to ensure that your users have the right C++ runtime installed for your addon binary to work. For example, if you compiled your binary with Visual Studio 2013 then your users would need This "C++ Redistributable".

OS X

On OS X you'll need to make sure you compile your module with the desired value passed to the -mmacosx-version-min flag.

Linux

On Linux you'll need to make sure to create your binaries on the oldest system you want to support. This means practically that if you create your binaries on Ubuntu Precise they will work on Ubuntu Precise and any other Linux distro more recent (like Debian Sid or Ubuntu Trusty).

See the External-libraries for all the details.

Does a binary exist for a given platform and how can I manually download it?

If you'd like to know if a binary exists and download it outside of an npm install scenario you can use node-pre-gyp on the command line like:

$ git clone [email protected]:nodegit/nodegit.git
$ cd nodegit
$ npm install node-pre-gyp
# reveal the url to the hosted binary for your system arch (for me OS X):
$ ./node_modules/.bin/node-pre-gyp reveal hosted_tarball --silent
 https://s3.amazonaws.com/nodegit/nodegit/nodegit-v0.1.4-node-v11-darwin-x64.tar.gz 
# reveal the url to the windows version:
$ ./node_modules/.bin/node-pre-gyp reveal hosted_tarball --silent --target_platform=win32
https://s3.amazonaws.com/nodegit/nodegit/nodegit-v0.1.4-node-v11-win32-x64.tar.gz
# confirm it exists
$ curl -s -I $(./node_modules/.bin/node-pre-gyp reveal hosted_tarball --silent --target_platform=win32) | grep '200 OK'
HTTP/1.1 200 OK # yep!