Yapi本地搭建及错误解决

参考 https://www.jianshu.com/p/5bda5556c149

安装 Mongo并启动

安装yapi-cli

npm install -g yapi-cli

启动

yapi server

浏览器打开

http://0.0.0.0:9090/

  • 问题1:初始化数据库报错
    Error: (node:90198) 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.

解决方法
cd ~/my-yapi/vendors
vim exts/server/utils.js 22行 添加 useUnifiedTopology: true

 let options = {useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true};

参考官网的命令行部署方式 https://hellosean1025.github.io/yapi/devops/index.html

npm run install-server
  • 问题2:初始化管理员账号失败

解决方法:删除mongodb数据库中已创建的管理员数据,重新运行

初始化管理员账号成功,账号名:"[email protected]",密码:"ymfe.org"

启动服务

cd  ~/my-yapi
node vendors/server/app.js

访问网站

http://127.0.0.1:3000/ 使用账号 密码登录即可

官方使用教程:https://hellosean1025.github.io/yapi/

猜你喜欢

转载自www.cnblogs.com/superhin/p/12340560.html