尝试从node.js上传到Amazon S3得到此错误我花了一整天找到错误没有运气,图像魔术安装,应用程序在弹性beanstalk上运行,以前安装在开发服务器上,代码工作得很好当我将应用程序移动到aws导致此错误我检查了所有依赖项与开发服务器相同。
Node.js Log
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);
});
});
});
答案 0 :(得分:2)
这是您的问题:/bin/sh: identify: command not found
未安装程序标识,需要在EB实例上安装imagemagick。在.ebextensions / packages.config中添加
packages:
yum:
ImageMagick: []