gpt4 book ai didi

javascript - 那么不是一个函数

转载 作者:太空宇宙 更新时间:2023-11-04 03:29:35 27 4
gpt4 key购买 nike

我正在我的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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com