繁体   English   中英

未捕获的 promise 拒绝:无法评估模块“nanoid”的源:node_modules/nanoid/index.cjs

[英]uncaught promise rejection: failed to eval source for module 'nanoid': node_modules/nanoid/index.cjs

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

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

从 MongoDB realm 运行时,但它抛出:

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 仪表板中看到的所有错误。

可能缺少什么?

对我有用的解决方案:

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM