【问题标题】:I am running Express JS project, but it showing any mongoose error [duplicate]我正在运行 Express JS 项目,但它显示任何猫鼬错误 [重复]
【发布时间】:2022-01-06 19:10:26
【问题描述】:

我从 git 克隆了一个旧项目,它运行良好。但是现在显示这个错误

(node:88186) UnhandledPromiseRejectionWarning: MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string. at NativeConnection.Connection.openUri (/Users/mobeenikhtiar/Downloads/slack's_downloaded_data/shopala-backend-56fb4bdcc8bd8024578ea82a0aef49c21a270563/node_modules/mongoose/lib/connection.js:684:11)

【问题讨论】:

  • 谢谢,我错过了导入 env 文件。需要('dotenv').config();

标签: node.js mongoose


【解决方案1】:

与此相关的问题,请点击此链接获取答案。 The `uri` parameter to `openUri()` must be a string, got "undefined"

【讨论】:

  • 当问题重复时使用close按钮
  • 我不能关闭这个,因为我没有金徽章,请你这样做。
  • 谢谢,这有帮助。我忘了在 index.js 中配置 dotenv
猜你喜欢
  • 2016-09-06
  • 2021-03-10
  • 2019-07-23
  • 2018-08-31
  • 2018-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-17
相关资源
最近更新 更多