在heroku上的node.js应用程序中使用Magick ++ [英] Using Magick++ in a node.js application on heroku

查看:168
本文介绍了在heroku上的node.js应用程序中使用Magick ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个Node应用程序推送到heroku,但我正在使用 imagemagick-native ,似乎Heroku有一个Magick ++的问题 - 我试过使用自定义构建包,但似乎无法找到支持Magick ++的构件。 (1)问题是否存在(2)是否有任何解决方案在Heorku上运行Magick ++?

  -----> ; Node.js应用检测到
----->解析引擎版本
使用Node.js版本:0.10.20
使用npm版本:1.3.11
----->获取Node.js二进制文件
----->将节点卖给slug
----->使用npm
安装依赖关系npm WARN package.json upload@0.1.3'repositories'(复数)不支持。
npm WARN package.json请选择一个作为'repository'字段

> bson@0.2.2 install / tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / mongoose / node_modules / mongodb / node_modules / bson
> (node-gyp rebuild 2> builderror.log)|| (出口0)
$ b $ make:进入目录`/ tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / mongoose / node_modules / mongodb / node_modules / bson / build'
CXX目标)Release / obj.target / bson / ext / bson.o
SOLINK_MODULE(target)Release / obj.target / bson.node
SOLINK_MODULE(target)Release / obj.target / bson.node:已完成
COPY Release / bson.node $ b $ make:离开目录`/ tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / mongoose / node_modules / mongodb / node_modules / bson / build'

> kerberos@0.0.3 install / tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / mongoose / node_modules / mongodb / node_modules / kerberos
> (node-gyp rebuild 2> builderror.log)|| (出口0)
$ b $ make:进入目录`/ tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / mongoose / node_modules / mongodb / node_modules / kerberos / build'
SOLINK_MODULE(目标)Release / obj.target / kerberos.node
SOLINK_MODULE(target)Release / obj.target / kerberos.node:Finished
COPY Release / kerberos.node $ b $ make:离开目录`/ tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / mongoose / node_modules / mongodb / node_modules / kerberos / build'

> imagemagick-native@0.2.8 install / tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / imagemagick-native
> node-gyp重建

/ bin / sh:Magick ++ - config:找不到
gyp:调用'Magick ++ - config --ldflags --libs'返回退出状态127.尝试加载binding.gyp
gyp ERR!配置错误
gyp ERR!堆栈错误:`gyp`失败,退出代码:1
gyp ERR!在ChildProcess.onCpExit(/tmp/node-npm-k25M/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR!堆栈在ChildProcess.EventEmitter.emit(events.js:98:17)
gyp ERR!堆栈在Process.ChildProcess._handle.onexit(child_process.js:789:12)
gyp ERR!系统Linux 3.8.11-ec2
gyp ERR!命令node/tmp/node-npm-k25M/node_modules/node-gyp/bin/node-gyp.jsrebuild
gyp ERR! cwd / tmp / build_d2a98573-34b8-42d9-91ff-81c4ca84feb9 / node_modules / imagemagick-native
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.10.10
gyp ERR!不行
npm ERR!奇怪的错误1
npm ERR!不好的代码0
!无法用npm

重建依赖关系!推送被拒绝,无法编译Node.js应用程序


解决方案

I在这方面取得了一些进展:

使用 multi buildpack

  heroku config:set BUILDPACK_URL = https://github.com/ddollar/heroku -buildpack-multi.git 

为了能够载入 apt-buildpack 除了nodejs之外。在 .buildpacks 中列出你的组件包:

  https:// github。 com / ddollar / heroku-buildpack-apt.git 
https://github.com/heroku/heroku-buildpack-nodejs.git

现在通过apt将 libmagick ++ - dev 安装在名为 Aptfile package.json 中包含imagemagick-native:




$ b

 dependencies:{
imagemagick-native:1.7.0
}

它将开始编译。虽然 $ CPATH 由APT包正确设置,但是 node-gyp 似乎没有将其转发给gb。

这会导致以下错误:

 远程:> ; imagemagick-native@1.7.0 install / tmp / build_720834c3a32b65d69ae603d7c618e20f / node_modules / imagemagick-native 
remote:> node-gyp重建
remote:
remote:make:进入目录`/ tmp / build_720834c3a32b65d69ae603d7c618e20f / node_modules / imagemagick-native / build'
remote:CXX(target)Release / obj.target / imagemagick / src / imagemagick.o
remote:包含在../src/imagemagick.cc:9中的文件:
remote:../src/imagemagick.h:1:22:warning:Magick ++ .h:没有这样的文件或目录

所以它不能解决问题,但我认为它在正确的轨道上。仍然试图找出node-gyp有什么问题。






更新



要解决该问题,请将nodejs buildpack分叉,并将以下行添加到 bin / compile 的顶部:

  path =`echo$ INCLUDE_PATH| cut -d:-f 1` 
export CXX =`which g ++`-I $ path / ImageMagick

适用于 cedar-14 。对于已弃用的 cedar ,您需要使用imagemagick-native v1.22。


I'm trying to push a Node app to heroku, but I am using imagemagick-native and it seems that Heroku is having an issue with Magick++ - I've tried using custom build packs but can't seem to find one that supports Magick++. (1) Is this the issue (2) Is there any solution to run Magick++ on Heorku?

-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.10.20
       Using npm version: 1.3.11
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm WARN package.json upload@0.1.3 'repositories' (plural) Not supported.
       npm WARN package.json Please pick one as the 'repository' field

       > bson@0.2.2 install /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/bson
       > (node-gyp rebuild 2> builderror.log) || (exit 0)

       make: Entering directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
         CXX(target) Release/obj.target/bson/ext/bson.o
         SOLINK_MODULE(target) Release/obj.target/bson.node
         SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
         COPY Release/bson.node
       make: Leaving directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'

       > kerberos@0.0.3 install /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
       > (node-gyp rebuild 2> builderror.log) || (exit 0)

       make: Entering directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
         SOLINK_MODULE(target) Release/obj.target/kerberos.node
         SOLINK_MODULE(target) Release/obj.target/kerberos.node: Finished
         COPY Release/kerberos.node
       make: Leaving directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'

       > imagemagick-native@0.2.8 install /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/imagemagick-native
       > node-gyp rebuild

       /bin/sh: Magick++-config: not found
       gyp: Call to 'Magick++-config --ldflags --libs' returned exit status 127. while trying to load binding.gyp
       gyp ERR! configure error
       gyp ERR! stack Error: `gyp` failed with exit code: 1
       gyp ERR! stack     at ChildProcess.onCpExit (/tmp/node-npm-k25M/node_modules/node-gyp/lib/configure.js:424:16)
       gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
       gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
       gyp ERR! System Linux 3.8.11-ec2
       gyp ERR! command "node" "/tmp/node-npm-k25M/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
       gyp ERR! cwd /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/imagemagick-native
       gyp ERR! node -v v0.10.20
       gyp ERR! node-gyp -v v0.10.10
       gyp ERR! not ok
       npm ERR! weird error 1
       npm ERR! not ok code 0
 !     Failed to rebuild dependencies with npm

 !     Push rejected, failed to compile Node.js app

解决方案

I've made some progress on this:

Use the multi buildpack:

heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

So that it can load the apt-buildpack in addition to the nodejs one. List your builpacks in .buildpacks:

https://github.com/ddollar/heroku-buildpack-apt.git
https://github.com/heroku/heroku-buildpack-nodejs.git

Now install libmagick++-dev through apt by listing it in a file called Aptfile.

Now if you include imagemagick-native in your package.json:

"dependencies": {
    "imagemagick-native": "1.7.0"
}

It will start compiling. And although $CPATH is set properly by the APT package, node-gyp somehow doesn't seem to forward it to gcc.

This causes the following error:

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

So it doesn't solve the problem yet, but I think it's on the right track. Still trying to figure out what's up with node-gyp.


Update

To workaround that problem fork the nodejs buildpack and add the following lines to the top of bin/compile:

path=`echo "$INCLUDE_PATH" | cut -d : -f 1`
export CXX="`which g++` -I$path/ImageMagick"

Works on cedar-14. For the deprecated cedar you would need to use imagemagick-native v1.22.

这篇关于在heroku上的node.js应用程序中使用Magick ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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