gpt4 book ai didi

heroku - 在 heroku 上的 node.js 应用程序中使用 Magick++

转载 作者:行者123 更新时间:2023-12-03 17:51:53 25 4
gpt4 key购买 nike

我正在尝试将 Node 应用程序推送到 heroku,但我正在使用 imagemagick-native似乎 Heroku 在使用 Magick++ 时遇到了问题——我尝试使用自定义构建包,但似乎找不到支持 Magick++ 的构建包。 (1) 这是问题吗 (2) 有没有办法在 Heorku 上运行 Magick++?

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

最佳答案

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

使用 multi buildpack :

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

以便它可以加载 apt-buildpack除了nodejs之一。在 .buildpacks 中列出您的 builpacks :
https://github.com/ddollar/heroku-buildpack-apt.git
https://github.com/heroku/heroku-buildpack-nodejs.git

现在安装 libmagick++-dev通过 apt 将其列在名为 Aptfile 的文件中.

现在,如果您在 package.json 中包含 imagemagick-native :
"dependencies": {
"imagemagick-native": "1.7.0"
}

它将开始编译。虽然 $CPATH由 APT 包正确设置, node-gyp不知何故似乎没有将它转发给gcc。

这会导致以下错误:
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

所以它还没有解决问题,但我认为它在正确的轨道上。仍在试图弄清楚 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。

关于heroku - 在 heroku 上的 node.js 应用程序中使用 Magick++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19612789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com