Win7部署Yapi
1、安装node
下载地址:https://nodejs.org/zh-cn/download/ (win7要下载v12.16之前的版本)
安装目录在D:\nodejs,配置地址(文件目录不能有特殊符号包括空格)
npm config set prefix "D:\nodejs\node-global" npm config set cache "D:\nodejs\node-cache"
设置环境变量D:\nodejs\node-global(这样就可以全局使用global里的脚本)
2、安装MongoDB
下载地址:http://dl.mongodb.org/dl/win32/x86_64
选择Custom,一路next一直到出现 "install mongoDB compass" 不勾选,否则可能要很长时间都一直在执行安装
设置环境变量D:\Program Files\MongoDB\Server\4.2\bin
在安装目录下\data\创建一个db目录
mongod.exe --dbpath "D:\Program Files\MongoDB\Server\4.2\data\db"
此时MongoDB已经开启,浏览器访问http://localhost:27017/
3、安装Yapi
D盘创建空文件夹,文件夹空白处鼠标右击会出现“Git Bash Here“
npm install -g yapi-cli --registry https://registry.npm.taobao.org yapi server
按照提示要求,打开网站http://localhost:9090/;点击开始部署,部署完成并成功后,可通过底部提示启动服务器。切换到D:\yapi\my-yapi,执行node vendors/server/app.js
4、Yapi设置后台运行
npm install -g pm2
pm2 start D:\yapi\my-yapi\vendors\server\app.js
pm2 stop D:\yapi\my-yapi\vendors\server\app.js
https://blog.51cto.com/onebig/2386082

浙公网安备 33010602011771号