You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Raspberry Pi 3上安装Heroku CLI(已解决,详见下文)

在Raspberry Pi 3上成功安装Heroku CLI的解决方案

问题已解决,下面我会分享亲测有效的安装步骤,先说说之前踩过的那些坑:

提前说明:若该问题已有人提问过,我深表歉意——我并未找到相关内容。

我手头有一台Raspberry Pi 3,尝试安装Heroku CLI时,用Ubuntu或Linux的常规安装方法全失败了。试过两种方案都不行:

第一种是直接下载指定压缩包的命令:

wget https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz

执行后直接返回404错误:

--2018-05-23 17:15:46-- https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
Resolving cli-assets.heroku.com (cli-assets.heroku.com)... 54.230.9.187, 54.230.9.194, 54.230.9.84, ...
Connecting to cli-assets.heroku.com (cli-assets.heroku.com)|54.230.9.187|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-05-23 17:15:50
ERROR 404: Not Found.

第二种是用官方的Ubuntu安装脚本:

wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

执行后出现一堆依赖配置错误:

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
dpkg: error processing package heroku (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of heroku-toolbelt:
 heroku-toolbelt depends on heroku (= 3.99.4); however:
  Package heroku is not configured yet.
dpkg: error processing package heroku-toolbelt (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 heroku
 heroku-toolbelt
E: Sub-process /usr/bin/dpkg returned an error code (1)

亲测有效的两种安装方法

之所以之前失败,核心原因是Raspberry Pi 3用的是ARM架构,官方默认提供的是x86架构的安装包,不兼容。下面两种方法都能解决这个问题:

方法一:通过npm全局安装

这是最简单的方式,步骤如下:

  1. 先更新系统并安装Node.js和npm:
sudo apt update && sudo apt install nodejs npm -y
  1. 全局安装Heroku CLI:
sudo npm install -g heroku
  1. 验证安装成功:
heroku --version

如果npm下载速度慢,可以先切换国内镜像源:

npm config set registry https://registry.npmmirror.com

方法二:下载ARM架构预编译包

如果不想用npm,也可以直接下载官方针对ARM的预编译包:

  1. 下载对应ARMv7的安装包(RPi3属于ARMv7架构):
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-arm.tar.gz
  1. 解压到系统目录:
sudo tar -xvzf heroku-linux-arm.tar.gz -C /usr/local/lib
  1. 创建软链接,让系统能全局调用heroku命令:
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
  1. 验证安装:
heroku --version

用上面任意一种方法,都能成功在Raspberry Pi 3上安装并使用Heroku CLI啦!

内容的提问来源于stack exchange,提问作者botbotbotty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:51:47