Node.js S3-uploader问题 [英] Node.js S3-uploader issue

查看:69
本文介绍了Node.js S3-uploader问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从node.js上传到Amazon S3时遇到此错误,我整天都在寻找错误,没有运气,安装了图像魔术,在弹性beantalk上运行的应用程序,以前安装在开发服务器上的代码在我运行时工作正常将应用程序移动到aws导致此错误,我检查了所有依赖项,其与开发服务器相同.

Trying to upload from node.js to Amazon S3 getting this error i spent all day to find an error no luck, image magic installed, app running on elastic beanstalk, previously installed on development server and code is working just fine when i move the application to aws its causing this error i checked all the dependencies its same as development server.

Node.js日志

    Upload data:tmp/c0005d84e41ec82b4f5ae2b1cbf1c3b8
{ [Error: Command failed: /bin/sh -c identify -format "name=
size=%[size]
format=%m
colorspace=%[colorspace]
height=%[height]
width=%[width]
orientation=%[orientation]
" tmp/c0005d84e41ec82b4f5ae2b1cbf1c3b8
/bin/sh: identify: command not found
]
  killed: false,
  code: 127,
  signal: null,
  cmd: '/bin/sh -c identify -format "name=\nsize=%[size]\nformat=%m\ncolorspace=%[colorspace]\nheight=%[height]\nwidth=%[width]\norientation=%[orientation]\n" tmp/c0005d84e41ec82b4f5ae2b1cbf1c3b8' }

S3上传选项

var client = new upload('XXX', {

    aws: {
     path: 'images/',
     region: 'us-east-1',
     acl: 'public-read',
     accessKeyId: 'XXX',
     secretAccessKey: 'XXXX'
   },

   cleanup: {
     versions: true,
     original: false
   },

   original: {
     awsImageAcl: 'private'
   },

   versions: [{
     maxWidth: 1040,
     format: 'jpg',
     suffix: '-large',
     quality: 80
   },{
     maxWidth: 780,
     suffix: '-medium',
     format: 'jpg',
     quality: 80
   }]
 });

上传脚本

app.post('/profile/upload', mupload.single('avatar'), function (req, res, next) {


    var data = req.file;
    console.log("Upload data:" + data.path);

    client.upload(data.path, {}, function(err, versions, meta) {
          console.log(err);
          console.log(meta);
          console.log("versions data:" + versions);
          versions.forEach(function(image) {
                    res.end(image.url);
          });


    });

});

推荐答案

这是您的问题:/bin/sh: identify: command not found

程序标识未安装,您需要在EB实例上安装imagemagick.在您的.ebextensions/packages.config中添加

the program identify is not installed, you need to install imagemagick on the EB instance. In your .ebextensions/packages.config add

packages:
  yum:
    ImageMagick: []

这篇关于Node.js S3-uploader问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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