如題在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