繁体   English   中英

如何在 Ubuntu 16.04 LTS 64 位上安装/启动 Postman native v4.10.3?

[英]How to install/start Postman native v4.10.3 on Ubuntu 16.04 LTS 64-bit?

我下载了 Linux 版 Postman(来自https://www.getpostman.com/apps ),将 .tar.gz 文件解压到~/bin/postman ,然后尝试执行~/bin/postman/Postman/Postman 不幸的是,它导致了以下错误:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'glob'
    at Module._resolveFilename (module.js:455:15)
    at Function.Module._resolveFilename (/home/imilosavljevic/bin/postman/Postman/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/imilosavljevic/bin/postman/Postman/resources/app/node_modules/electron-json-storage/node_modules/rimraf/rimraf.js:7:12)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)

有没有其他方法可以在 Ubuntu 上安装/启动 Postman?

是的,您可以使用以下命令安装 Postman:

wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
rm postman.tar.gz
sudo ln -s /opt/Postman/Postman /usr/bin/postman

您还可以让 Postman 出现在 Unity Launcher 中:

cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL

您不需要 node.js 或任何其他具有标准 Ubuntu 开发安装的依赖项。

https://blog.bluematador.com/posts/postman-how-to-install-on-ubuntu-1604/上的博客文章中查看更多信息。

编辑:更改 icon.png 位置。 最新版本的 Postman 稍微改变了它们的目录结构。

编辑:

如果您有snap或想要安装它,只需执行以下操作:

$ sudo snap install postman

如果您没有,请将其安装为:

$ sudo apt update
$ sudo apt install snapd

另一种方法是创建一个脚本:

首先创建这个脚本:

创建一个文件 install-postman.sh,在里面添加:

#!/bin/bash
cd /tmp || exit
echo "Downloading Postman ..."
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
tar -xzf postman.tar.gz
rm postman.tar.gz

echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
    sudo rm -rf /opt/Postman
fi
sudo mv Postman /opt/Postman

echo "Creating symbolic link..."
if [ -L "/usr/bin/postman" ];then
    sudo rm -f /usr/bin/postman
fi
sudo ln -s /opt/Postman/Postman /usr/bin/postman

echo "Installation completed successfully."
echo "You can use Postman!"

在终端中运行它:

$ sh install-postman.sh

然后创建桌面启动器:

邮递员桌面

[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;

如果需要,可以将此文件放在桌面上(不要忘记授予它执行权限)。 双击,就是这样!

永远感谢 Aviskase(github 账号名)。

来源 -> https://gist.github.com/aviskase/e642248c35e400b56e2489430952369f#file-postman-desktop

sudo snap install postman

这个单一的命令对我有用。

这对我在Ubuntu 18.04和 Postman v7.1.1 上工作,该版本于 2019 年 5 月 20 日发布。

下载最新版本的Postman

很可能您下载的文件应该在下载文件夹中。

# Postman-linux-x64-7.1.1.tar.gz is my downloaded file

cd /home/YOUR_USERNAME/Downloads/
tar -xzf Postman-linux-x64-7.1.1.tar.gz Postman/
sudo mv Postman /usr/share/postman
sudo ln -s /usr/share/postman/Postman /usr/bin/postman

如果你遇到这样的错误,

/usr/share/postman/Postman: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

请安装libgconf-2-4

sudo apt install libgconf-2-4

只需在终端中输入postman并按回车键即可运行最新版本的 Postman。 现在我们必须为您的启动器创建一个 Unity 桌面文件。 要创建postman.desktop文件,请运行以下命令。

sudo nano ~/.local/share/applications/postman.desktop

然后将以下postman.desktop行粘贴到postman.desktop文件中。

[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/usr/share/postman/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;

现在您可以在 Unity 启动器中看到“邮递员”图标。 如果您错过任何一点,请浏览此视频或在下面发表评论。

邮递员 7.1.1

不要忘记添加sudo否则你会得到postman.tar.gz: Permission denied错误。 如果出现无法创建符号链接/usr/bin/postman类的错误,请取消链接/usr/bin/postman :文件存在。 所以下面是完整的代码:

sudo wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo rm postman.tar.gz

sudo unlink /usr/bin/postman
sudo ln -s /opt/Postman/Postman /usr/bin/postman

然后在终端中运行邮递员。

是的,我发现了一个很棒的简单 bash 脚本,它允许您直接从名为postman-updater-linux的终端更新 Postman Linux 应用程序

只需使用 NPM 安装它:

npm install -g postman-updater-linux

然后检查更新:

sudo postman-updater check

然后安装:

sudo postman-updater install

或更新:

sudo postman-updater update

通过将-l /your/custom/path添加到此命令的末尾,所有最后三个命令都可以与自定义位置一起使用。

打开终端并输入命令

sudo snap install postman

如果它要求输入密码,请点击 Enter 按钮输入并继续它将安装邮递员

如果上述解决方案对您不起作用,那么您应该先安装 snap 以安装它

sudo apt update
sudo apt install snapd

成功安装 snap 后,您就可以使用它的软件包并按照我的邮递员解决方案进行操作

不要忘记

chmod ~/.local/share/applications/postman.desktop +x

否则它不会显示在 Unity Launcher 中

为了做同样的事情,我在终端中做了以下-

$ wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
$ sudo tar -xzf postman.tar.gz -C /opt
$ rm postman.tar.gz
$ sudo ln -s /opt/Postman/Postman /usr/bin/postman
  1. 现在打开文件系统,移动到/usr/bin/并搜索表单“ Postman
  2. 有一个名为“Postman”的 sh 文件
  3. 双击它打开邮递员。
  4. 右键单击其图标以将图标锁定到启动器以供进一步使用。

希望也会让其他人陷入困境。

在我将其添加到 .desktop 文件之前,让“Run in Postman”链接与浏览器一起使用时遇到问题

MimeType=application/postman;x-scheme-handler/postman;

由于 postman chrome 应用程序已弃用,因此 Postman Native 应用程序可用于支持本机平台。 您可以使用终端中的命令通过 Snap 商店在 Linux/Ubuntu 上安装 Postman。

$ snap 安装邮递员

成功安装后,您可以在应用程序列表中找到它。

https://www.postman.com/downloads/下载最新版本的邮递员,然后在下载 tar.gz 文件后按照以下命令

$ tar -xvzf Postman-linux-x64-7.27.1.tar.gz
$ cd Postman
$ ./Postman

您还需要安装 nodejs:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM