centos7安装yapi(转)

如题在linux下安装yapi。官方安装文档安装之前确保已经安装了npm mongodb和git。

npm install -g yapi-cli --registry https://registry.npm.taobao.org
yapi server
 

 

执行后效果如下

 

 

填写基础的信息

 

静静等待安装成功

 

按照提示执行命令

 

 

安装成功

 

有可能会遇到以下错误

yapi server
在浏览器打开 http://0.0.0.0:9090 访问。非本地服务器,请将 0.0.0.0 替换成指定的域名或ip
events.js:173
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::9090
at Server.setupListenHandle [as _listen2] (net.js:1256:14)
at listenInCluster (net.js:1304:12)
at Server.listen (net.js:1392:7)
at Function.serverListen [as listen] (/usr/local/lib/node_modules/yapi-cli/node_modules/express-ws/lib/index.js:42:40)
at Object.run [as handler] (/usr/local/lib/node_modules/yapi-cli/src/commands/server.js:92:9)
at Object.runCommand (/usr/local/lib/node_modules/yapi-cli/node_modules/yargs/lib/command.js:226:22)
at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/yapi-cli/node_modules/yargs/yargs.js:970:30)
at Function.get [as argv] (/usr/local/lib/node_modules/yapi-cli/node_modules/yargs/yargs.js:912:21)
at Object.<anonymous> (/usr/local/lib/node_modules/yapi-cli/src/index.js:19:9)
at Module._compile (internal/modules/cjs/loader.js:736:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
at Function.Module._load (internal/modules/cjs/loader.js:560:3)
at Module.require (internal/modules/cjs/loader.js:665:17)
at require (internal/modules/cjs/helpers.js:20:18)
Emitted 'error' event at:
at Server.WebSocketServer._ultron.on (/usr/local/lib/node_modules/yapi-cli/node_modules/ws/lib/WebSocketServer.js:85:46)
at Server.emit (events.js:197:13)
at emitErrorNT (net.js:1283:8)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
at executeUserCode (internal/bootstrap/node.js:526:15)
at startMainThreadExecution (internal/bootstrap/node.js:439:3)
这是之前的运行过yapi但是没有杀死进程而已。ps aux | grep yapi找到进程杀死即可。
————————————————
版权声明:本文为CSDN博主「the ache」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44600422/article/details/89345944

posted @ 2020-03-17 16:44  TesterLiao  阅读(1095)  评论(0编辑  收藏  举报