蓝冠官网-蓝冠公司|蓝冠招商注册-蓝冠开户
蓝冠官网(主管Q374919)

蓝冠测速官网_请问一下typescript的config问题,抱歉,我是typescript新手

我在用typescript做nodejs的backend,然后它一直有配置错误

/home/paul/桌面/classroomeditor-backend/lib/register.js:40
var lowdb_1 = require("lowdb");
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/paul/桌面/classroomeditor-backend/node_modules/lowdb/lib/index.js from /home/paul/桌面/classroomeditor-backend/lib/register.js not supported.
Instead change the require of index.js in /home/paul/桌面/classroomeditor-backend/lib/register.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/paul/桌面/classroomeditor-backend/lib/register.js:40:15)
    at Object.<anonymous> (/home/paul/桌面/classroomeditor-backend/main.js:4:18) {
  code: 'ERR_REQUIRE_ESM'
}

请问我需要做什么调整
我的tsconfig.json档完全照预设

我的file tree

/functions
    register.ts
/lib(tsc outdir)
    register.js
main.js

command

node main.js

拜托了各位高手。

2022-10-04