我已经在heroku上部署了我的meteor应用程序,并使用CollectionFS将图像文件上传到亚马逊S3。一切都很正常,直到我上传了几张图片,然后由于部署的原因不得不重新启动服务器。
我的转换代码:
transformWrite: function(fileObj, readStream, writeStream) {
try {
gm(readStream, fileObj.name()).resize(width, height, opts.resize).interlace(opts.interlace).stream().pipe(writeStream);
} catch (error) {
throw new Meteor.Error(error);
}
}但是自从第一次重启后,我就无法再次启动服务器了。这就是我一直得到的错误。
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch.
Stopping process with SIGKILL
FS.Transform.createWriteStream transform function failed, Error:
Exception in queued task: TypeError: Cannot read property 'resize' of undefined
State changed from starting to crashed
Process exited with status 137目前,我已经注释掉了所有的collectionFS代码,这帮助我恢复了站点。代码在本地运行得很好,但是heroku部署总是失败。
发布于 2015-12-24 06:40:11
解决问题的关键是:TypeError: Cannot read property 'resize' of undefined。
请参见您的代码:gm(readStream, fileObj.name()).resize(...)
换句话说,heroku是未定义的,您可以放心地假定您的gm实例上没有安装graphicsmagick。
尝试使用以下命令:https://github.com/mcollina/heroku-buildpack-graphicsmagick
https://stackoverflow.com/questions/34427905
复制相似问题