# Yapi 安装报错 yapi pass option { useUnifiedTopology: true } to the MongoClient constructor.

**URL:** <https://www.shiqidu.com/t/topic/689>\
**Category:** 开发调优\
**Tags:** MongoDB\
**Created:** [February 17, 2020, 1:47pm UTC](https://www.shiqidu.com/t/topic/689 "2020-02-17T13:47:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leon](https://www.shiqidu.com/user_avatar/www.shiqidu.com/leon/32/5_2.png) [@Leon](https://www.shiqidu.com/u/Leon)\
**Post date:** [February 17, 2020, 1:47pm UTC](https://www.shiqidu.com/t/topic/689/1 "2020-02-17T13:47:02Z")

</div>

安装yapi时报错如下

```auto
DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

```

**解决方法**

修改 `vendors/server/utils/db.js` 文件，在22行，增加 `useUnifiedTopology: true`。  
然后按照官方的安装方式二继续安装

```bash
npm install --production --registry https://registry.npm.taobao.org
npm run install-server //安装程序会初始化数据库索引和管理员账号，管理员账号名可在 config.json 配置
node server/app.js //启动服务器后，请访问 127.0.0.1:{config.json配置的端口}，初次运行会有个编译的过程，请耐心等候

```

如果报错 mongodb 重复插入，就删除 mongodb 的 yapi 库的 user 表的数据，重新安装一次即可。
