【问题标题】:Node.js S3-uploader issueNode.js S3 上传器问题
【发布时间】:2017-02-17 01:46:29
【问题描述】:

尝试从 node.js 上传到 Amazon S3 时遇到此错误我花了一整天的时间才发现错误没有运气,安装了图像魔术,应用程序在弹性 beanstalk 上运行,以前安装在开发服务器上,并且代码在我运行时运行良好将应用程序移动到导致此错误的aws 我检查了与开发服务器相同的所有依赖项。

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);
          });


    });

});

【问题讨论】:

    标签: node.js amazon-web-services express amazon-s3 amazon-elastic-beanstalk


    【解决方案1】:

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

    程序识别未安装,需要在EB实例上安装imagemagick。在你的 .ebextensions/packages.config 添加

    packages:
      yum:
        ImageMagick: []
    

    【讨论】:

      猜你喜欢
      • 2017-08-12
      • 2017-05-22
      • 2013-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-02
      • 1970-01-01
      • 2015-12-30
      相关资源
      最近更新 更多