/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
檔完全照預設
/functions
register.ts
/lib(tsc outdir)
register.js
main.js
node main.js
拜託了各位高手。
該套件使用 ES Module,與 CommonJS 不相容。
可參考: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c