0

我正在尝试使用 nanoid ( https://www.npmjs.com/package/nanoid/v/2.1.2 )

exports = async function(){
  const nanoid = require("nanoid");
  const uid = nanoid(10);
}

从 MongoDB 领域运行时,但它抛出:

uncaught promise rejection: failed to eval source for module 'nanoid': node_modules/nanoid/index.cjs: Line 9:7 Unexpected identifier (and 16 more errors)

这就是我可以从 Realm Dashboard 中看到的所有错误。

可能缺少什么?

4

1 回答 1

0

对我有用的解决方案:

  • 安装较低版本的 nanoid
npm i nanoid@2.1.2

然后通过仪表板将包上传到 MongoDB Realm 函数。

于 2021-02-16T20:41:47.223 回答