typescript - readFileSync error occurs when to read yaml file
问题描述
I'm trying to read a yaml file with Type Script. But I get an error of readFileSync and cannot read it. What should I do?
fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync is not a function
import fs from 'fs'
import yaml from 'js-yaml'
export const en = yaml.safeLoad(fs.readFileSync('./en.yml', 'utf8'))
解决方案
推荐阅读
- sharepoint - 在 Power Automate 中使用 concat 函数时遇到问题
- perl - Excel::Writer::XLSX (Perl) 工作表内省
- python - 通过自动检测列名将 XML 转换为 Pandas 数据帧
- javascript - 打字稿强制转换函数参数类型
- java - Apache Pulsar - 主题授权失败 - 无权管理此租户的资源
- javascript - 如何将多个标记添加到谷歌地图?
- windows-installer - 为 Freedom Scientific Fusion 2020 exe 构建 MSI,在没有 EULA 复选框的情况下静默安装?
- mysql - 聊天 mySQL 表,选择语句查找唯一对话
- rust - 错误[E0515]:无法返回引用临时值的值
- react-navigation - 如何为特定路线指定自定义转换,而不是屏幕(v5)