Brian D
Brian D

Reputation: 10153

Node-gyp and custom dependency / library / header install path

I have a build environment in which my libraries (and headers) are installed to a custom location. When installing a package from npm, modules that use node-gyp fail because they cannot find the libraries (or headers) I've installed. How can I make node-gyp aware of my custom install location (linux)?

Upvotes: 6

Views: 2017

Answers (1)

Brian D
Brian D

Reputation: 10153

If you set CXXFLAGS and LDFLAGS before npm install <pkg> in the same line, it seems to work:

$ CXXFLAGS=-I/path/to/include LDFLAGS=-L/path/to/lib npm install <pkg>

Alternatively you can export the flags prior to the npm install

$ export CXXFLAGS=-I/path/to/include
$ export LDFLAGS=-L/path/to/lib
$ npm install <native-package>

Upvotes: 7

Related Questions