Heroku NodeJS + CouchBase自定义构建包 [英] Heroku NodeJS + CouchBase Custom Buildpack

查看:137
本文介绍了Heroku NodeJS + CouchBase自定义构建包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用NodeJS和CouchBase模块/库构建自定义的buildpack

I'm trying to put together a custom buildpack with NodeJS and the CouchBase module/libraries

我已经使用Vulcan来构建libcouchbase和libvbucket

I've gotten as far as using Vulcan to build libcouchbase and libvbucket and getting the buildpack to retrieve and unpack the tgz files for both.

一切看起来都不错,但是当npm尝试安装couchbase模块时,我收到错误消息:

Everything looks ok there, but I receive errors when npm tries to install the couchbase module:

我遇到了很多错误,但是这一行:

I get a bunch of errors, but this line:

../ src / couchbase_impl.h:52: 36:警告:libcouchbase / couchbase.h:没有这样的文件或目录

"../src/couchbase_impl.h:52:36: warning: libcouchbase/couchbase.h: No such file or directory"

导致我认为它找不到libcouchbase库(这是可能的,因为它们不在通常的位置。)

leads me to think that it can't find the libcouchbase libraries (which is possible since they aren't in the usual place).

我尝试使用CPPFLAGS =-I / app / vendor / couchbase / include / libcouchbase添加正确的路径在Config Vars中,只是将其作为编译阶段的一部分导出,但还是没有运气。

I've tried to add the correct path using CPPFLAGS="-I/app/vendor/couchbase/include/libcouchbase" in both the Config Vars and just exporting that as part of the compile phase, but still no luck.

以下是要点,其中包含Heroku部署输出和编译/发行版buildpack文件:
https://gist.github.com/ahamidi/5620503

Here is the gist with the Heroku deploy output and the compile/release buildpack files: https://gist.github.com/ahamidi/5620503

任何帮助将不胜感激。

谢谢

Ali

[更新1]

我已经取得了一些进步,现在,当部署到Heroku时,我就可以编译了。

I've made some progress and I can now get the slug to compile when deploying to Heroku.

关键是弄清楚CouchNode在添加要包含的自定义目录时要查找的ENV变量。

The key was figuring out the ENV Variables that CouchNode looks for when adding custom directories to include.

在在这种情况下,Env变量为EXTRA_CPPFLAGS和EXTRA_LDFLAGS。

In this case, the Env Variables were EXTRA_CPPFLAGS and EXTRA_LDFLAGS.

所以我更新了编译文件,使其包括以下内容:

So I updated the compile file to include the following:

export EXTRA_CPPFLAGS="-I$BUILD_DIR/vendor/couchbase/include" 
export EXTRA_LDFLAGS="-L$BUILD_DIR/vendor/couchbase/lib -Wl,-rpath,$BUILD_DIR/vendor/couchbase/lib"

该文件会编译并已部署该应用程序,但是我现在在日志中得到另一个错误:

The slug compiles and the app is deployed, but I now get a different error in the logs:

Error: libcouchbase.so.2: cannot open shared object file: No such file or directory

所以Node似乎看不到libcouchbase库目录。

So it looks like Node can't see the libcouchbase libraries directory.

推荐答案

对于任何好奇或遇到类似问题的人,这都是对我有用的东西。

For anyone who is curious or experiencing a similar issue, here's what worked for me.

为了得到沙发要安装这些npm模块,我必须告诉它在哪里可以找到libcouchbase库(在编译文件中):

In order to get the couchbase npm module to install I had to tell it where to find the libcouchbase libraries (in compile file):

export EXTRA_CPPFLAGS="-I$BUILD_DIR/vendor/couchbase/include" 
export EXTRA_LDFLAGS="-L$BUILD_DIR/vendor/couchbase/lib -Wl,-rpath,$BUILD_DIR/vendor/couchbase/lib"

然后为了在我的应用程序中需要沙发床,我必须设置以下环境变量:

Then in order to require couchbase in my app I had to set the following Env Variable:

LD_LIBRARY_PATH="/app/vendor/couchbase/lib:$LD_LIBRARY_PATH"

使用命令:

heroku config:add LD_LIBRARY_PATH="/app/vendor/couchbase/lib:$LD_LIBRARY_PATH"

这篇关于Heroku NodeJS + CouchBase自定义构建包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆