我在带有 express.js 的 Linux 服务器上使用gm for node.js 。它适用于小于 2MB 文件大小的图像。但是一旦超过代码停止工作。这是代码
gm('public/'+article.page.image)
.resize(width,height)
.quality(80)
.write('public/article_image/'+ folder + '/' + "something.jpg", function(err){
if (err){
console.log('error occurred')
console.log(err)
}
else{
console.log('resized image 16')
somefunction(16, true);
}
})
我面临的错误是
Error: Command failed:
at ChildProcess.onExit (/root/patarboi/node_modules/gm/lib/command.js:301:17)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket.<anonymous> (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12) code: null, signal: 'SIGSEGV'
如何解决这个问题?