centos7安装yapi

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

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

执行后效果如下
centos7安装yapi_第1张图片

填写基础的信息
centos7安装yapi_第2张图片
静静等待安装成功
centos7安装yapi_第3张图片
按照提示执行命令
centos7安装yapi_第4张图片

安装成功
centos7安装yapi_第5张图片

有可能会遇到以下错误

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. (/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找到进程杀死即可。

你可能感兴趣的:(centos7安装yapi)