会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
信尚
博客园
|
首页
|
新随笔
|
新文章
|
联系
|
订阅
|
管理
2023年6月14日
[nodejs] [ERR_REQUIRE_ESM]: require() of ES Module
摘要: * 原因 EM模块不支持require引入 * 解决 1. 单个文件时,文件的后缀名改为.mjs 2. 多个文件时,在package.json中指定type为module,使用ESM
阅读全文
posted @ 2023-06-14 16:43 信尚
阅读(1636)
评论(0)
推荐(0)
[nodejs] __dirname is not defined in ES module scope
摘要: 原因:CommonJS 中提供的全局变量如require, exports, module.exports, __filename, __dirname 等,在 ES Modules 环境中均是不可用的,require, exports, module.exports 在 ES Modules 中基
阅读全文
posted @ 2023-06-14 16:35 信尚
阅读(1249)
评论(0)
推荐(0)
公告