本文介绍: 遇到这个错误,上代码:import thenFs from ‘then-fs‘function getAllFile() { const r1 = await thenFs.readFile(‘./file/1.txt‘, ‘utf8′) console.log(r1) const r2 = await thenFs.readFile(‘./file/1.txt‘, ‘utf8′) console.log(r2) const r3 = await thenFs.readFi..
代码块如上所示,真的找了很久的bug,一直都不明白这个是什么意思,也看到了不少的说是 ESlint的问题,node.js 默认支持 common.js and so on。
但是实际意义上,是我 async没加!对就是这个这么蠢得错法。无语了。
解决办法:
async function getAllFile() {…..
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。