问题
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)?
回答1:
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>
来源:https://stackoverflow.com/questions/29832321/node-gyp-and-custom-dependency-library-header-install-path