我正在我的node.js 项目中运行以下代码。我需要“imagemin”和“imageminGifsicle”。我收到以下错误
}).then(files => { ^ TypeError: imagemin(...).then is not a function
我以前没有在我的项目中使用过 Promise 吗?我需要包含它们才能使用 .then 吗?
imagemin(['export/sample/out.gif'], 'export/sample/out2.gif', {
plugins: [
imageminGifsicle({optimizationLevel: 1})
]
}).then(files => {
console.log(files);
console.log("finished");
}).catch(err => {
console.log("ERR:"+err);
throw err;
});
最佳答案
.then
与 Promise 相关并且 imagemin
added this only on 5.0.0 .
您使用的是哪个版本?
关于javascript - 那么不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40059781/