温馨提示×

ubuntu怎么调试postman

小樊
49
2026-09-22 05:22:21
栏目: 智能运维

在 Ubuntu 上“调试 Postman”一般有两种理解,我分别说明,你可以看哪个更符合你的情况。


一、在 Ubuntu 上使用 Postman 调试接口(最常见)

如果你是说 用 Postman 调试 HTTP 接口,而不是调试 Postman 本身:

1. 安装 Postman

sudo snap install postman

或官网下载 AppImage:

chmod +x Postman*.AppImage
./Postman*.AppImage

2. 常见调试方法

  • 查看 Console
    • 打开 Postman → View → Show Postman Console
    • 可以看到请求/响应详情、证书、重定向
  • 查看响应
    • Headers / Body / Status
    • 使用 Pretty / Raw / Preview
  • 环境变量
    • 用 {{base_url}} 区分 dev / prod
  • Pre-request Script
    console.log(pm.request.url);
    
  • Tests
    pm.test("status 200", () => pm.response.to.have.status(200));
    

3. 本地服务调试

如果是 Ubuntu 本地服务:

curl http://127.0.0.1:8080/api

Postman 填:

http://127.0.0.1:8080/api

二、调试 Postman 本身(程序出问题)

如果你是说 Postman 在 Ubuntu 上崩了 / 打不开 / 卡死,那是调试 Postman 应用本身。

1. 看错误日志

postman

或

~/.config/Postman/logs/

2. 用命令行启动看报错

postman --disable-gpu

3. 常见问题

  • Snap 权限问题
    sudo snap connect postman:network
    
  • 依赖问题(非 Snap 版)
    sudo apt install libnss3 libgtk-3-0
    
  • 清空配置
    rm -rf ~/.config/Postman
    

三、调试后端 + Postman 联动(推荐)

如果你是调试 Ubuntu 上的后端服务:

  • 后端加日志
  • Postman 发请求
  • tcpdump / ngrep 看网络
sudo tcpdump -i lo port 8080

如果你能具体说一下:

  • 是 Postman 用不了
  • 还是 接口调不通
  • 还是 Postman 崩溃

我可以直接给你一步步操作命令。

0 踩