如何在Heroku测功机上安装htop?

问题描述

遵循htop的标准安装过程会产生以下错误

~/htop-2.2.0 $ ./configure 
checking build system type... x86_64-unkNown-linux-gnu
checking host system type... x86_64-unkNown-linux-gnu
checking target system type... x86_64-unkNown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/app/htop-2.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

解决方法

您不能以这种方式在Heroku上安装东西。

heroku run bash产生的one-off dyno将在您注销后立即丢弃。即使没有删除测功机,也不是您的应用程序运行的测功机。您想要安装的所有内容都需要在构建时安装,并包含在应用程序插件中。

相反,请使用its Ubuntu packagemultiple buildpacks通过heroku-buildpack-apt安装htop

类似

  • heroku buildpacks:set heroku/python
  • heroku buildpacks:add --index 1 heroku-community/apt

应该适用于Python应用程序。根据您要使用的主要buildpack修改第一个命令。

设置好构建包后,请在项目的根目录中创建一个新的Aptfile,其中包含要安装的软件包的名称:

htop

提交并部署。

您应该看到htop以及在构建时已安装的所有其他软件包。