本文介绍了Node-gyp和自定义依赖项/库/标头安装路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个构建环境,其中将我的库(和标头)安装到了自定义位置.从npm安装软件包时,使用node-gyp的模块失败,因为它们找不到我已安装的库(或标头).如何使node-gyp知道我的自定义安装位置(linux)?

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)?

推荐答案

如果在 npm install< pkg> 之前设置 CXXFLAGS LDFLAGS >在同一行中似乎有效:

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>

或者,您可以在 npm install

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

这篇关于Node-gyp和自定义依赖项/库/标头安装路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 03:23