Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js – 为节点gyp添加include dir大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在将一个node-js应用程序部署到heroku,需要@R_197_11350@pm包 imagemagic-native.

我使buildpack安装libmagick -dev并导出包含路径:

export INCLUDE_PATH="$BUILD_DIR/.apt/usr/include:$INCLUDE_PATH"
export CPATH="$INCLUDE_PATH"
export CPPPATH="$INCLUDE_PATH"

在@R_197_11350@pm install安装imagemagic-native软件包时,会调用node-gyp来编译它的二进制文件.但是我收到此错误

remote:        > imagemagick-native@1.7.0 install /tmp/build_720834c3a32b65d69ae603d7c618e20f/node_modules/imagemagick-native
remote:        > node-gyp rebuild
remote:        
remote:        make: Entering directory `/tmp/build_720834c3a32b65d69ae603d7c618e20f/node_modules/imagemagick-native/build'
remote:          CXX(target) Release/obj.target/imagemagick/src/imagemagick.o
remote:        In file included from ../src/imagemagick.cc:9:
remote:        ../src/imagemagick.h:1:22: warning: Magick++.h: No such file or directory

这表明gcc没有看到libmagick的头文件,因为$CCPATH不可用.

如何让npm install添加node-gyp使用的include_dirs列表的路径?

关于我的用例的更多细节在这里Using Magick++ in a node.js application on heroku

解决方法

尝试:

将环境变量CXX = / path /设置为/ g -Ipath / to / include

@R_618_10214@启动该过程.如果你正在使用bash,那就完成了

export CXX="/path/to/g++ -Ipath/to/include"

/ path / to / include是缺少@L_784_10@magick .h所在的位置

如果这不起作用,您可以手动设置CXX以在-file / build_720834c3a32b65d69ae603d7c618e20f / node_modules / imagemagick-native / build的makefile中包含-I,然后进入该目录并@L_4_2@make.

大佬总结

以上是大佬教程为你收集整理的node.js – 为节点gyp添加include dir全部内容,希望文章能够帮你解决node.js – 为节点gyp添加include dir所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。