如何解决NodeJs,画布未处理的PromiseRejection警告:错误:不支持的图像类型
Dependency :
canvas > version: 2.6.1
node > version: 12.12.62
我想做下面的事情:
const { createCanvas,loadImage } = require('canvas');
var image = await loadImage("png.png");
但是,同一段代码非常适合* .jpeg文件类型。
检查所有可能出现波纹管错误的点:
(node:2536) UnhandledPromiseRejectionWarning: Error: Unsupported image type
at setSource (********\node_modules\canvas\lib\image.js:91:13)
at Image.set (********\node_modules\canvas\lib\image.js:62:9)
at ********\landmark-detection\node_modules\canvas\index.js:34:15
at new Promise (<anonymous>)
at loadImage (********\node_modules\canvas\index.js:23:10)
at imageReconstruction (********\landmark-detection\app.js:159:22)
at ********\app.js:102:36
(node:2536) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block,or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2536) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,promise rejections that are not handled will terminate the Node.js
process with a non-zero exit code.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。