How To Use Heroku Cli On Windows
The Heroku CLI
Final updated Apr 26, 2022
Table of Contents
- Install the Heroku CLI
- Verify Your Installation
- Get Started with the Heroku CLI
- Staying Up to Appointment
- Useful CLI Plugins
- CLI Architecture
- Troubleshooting the Heroku CLI
- Uninstall the Heroku CLI
The Heroku Command Line Interface (CLI) lets you create and manage Heroku apps direct from the last. It'due south an essential role of using Heroku.
Install the Heroku CLI
Pre-requisites
The Heroku CLI requires Git, the popular version control system. If you lot don't already have Git installed, complete the following:
- Git installation
- Commencement-time Git setup
Install with an Installer
The Windows installers display a warning titled "Windows protected your PC" to some users. To run the installation when this warning shows, click "More info", verify the publisher as "salesforce.com, inc", so click the "Run anyway" button.
Snap installs are no longer supported. Please employ another install method beneath.
macOS
$ brew tap heroku/brew && brew install heroku Standalone Installation with a Tarball
The standalone install is a simple tarball with a binary. It contains its own node.js binary and autoupdates.
To prepare the CLI in /usr/local/lib/heroku and /usr/local/bin/heroku, run the following script. The script requires sudo and isn't Windows uniform.
$ gyre https://cli-avails.heroku.com/install.sh | sh You tin also download one of the following tarballs and excerpt it yourself.
Tarballs
These tarballs are bachelor in gz or xz compression. xz is much smaller simply gz is more compatible.
- macOS
- Linux (x64)
- Linux (arm)
- Windows (x64)
- Windows (x86)
Install with Ubuntu / Debian apt-get
$ curlicue https://cli-avails.heroku.com/install-ubuntu.sh | sh This version doesn't autoupdate. Update it manually via apt-get. Utilise the standalone installation for an autoupdating version of the CLI.
Install for Arch Linux
Install the community-maintained heroku-cli 7.60.1-1:
$ yay -South heroku-cli Install with npm
The CLI is built with Node.js and installable via npm. Utilise this manual install method in environments where autoupdating isn't platonic, or where Heroku doesn't offer a prebuilt Node.js binary. ARM and BSD must use this installation method. You lot must accept node and npm installed already. This method is also useful if yous want fine-grained control over CLI updates such as in a tested script.
It's strongly recommended to use 1 of the other installation methods if possible.
This installation method doesn't autoupdate. It also requires you to apply your system'south version of Node.js, which can be older than the version Heroku develops the CLI against. Heroku uses electric current releases of Node.js and doesn't back up older versions.
If you use whatever of the other installation methods, it includes the proper version of Node.js and doesn't disharmonize with whatever other version on your organisation.
Also, this method doesn't employ the yarn lockfile for dependencies similar the others do, even if yous install with yarn. This method can crusade issues if the CLI's dependencies become incompatible in minor or patch releases.
$ npm install -g heroku Verify Your Installation
To verify your CLI installation, use the heroku --version command:
$ heroku --version heroku/7.0.0 (darwin-x64) node-v8.0.0 The output looks like heroku/10.y.z. If you don't run into that output, and installed the Heroku CLI, cheque if you have an erstwhile heroku gem on your system. Uninstall it with these instructions.
Become Started with the Heroku CLI
After you install the CLI, run the heroku login command. Enter whatever key to go to your spider web browser to complete login. The CLI and so logs y'all in automatically.
$ heroku login heroku: Press any key to open up upwardly the browser to login or q to get out › Alert: If browser does not open up, visit › https://cli-auth.heroku.com/auth/browser/*** heroku: Waiting for login... Logging in... done Logged in as me@example.com If y'all'd prefer to stay in the CLI to enter your credentials, run heroku login -i.
You lot can't use the -i option if yous have multi-factor hallmark enabled due to a technical dependency on spider web browsers for verification.
$ heroku login -i heroku: Enter your login credentials Email: me@example.com Countersign: *************** Two-factor code: ******** Logged in as me@heroku.com The CLI saves your electronic mail address and an API token to ~/.netrc for future use. For more information, run across Heroku CLI Authentication.
Now yous're ready to create your start Heroku app:
$ cd ~/myapp $ heroku create Creating app... done, ⬢ sleepy-meadow-81798 https://sleepy-meadow-81798.herokuapp.com/ | https://git.heroku.com/sleepy-meadow-81798.git Cheque out your preferred linguistic communication'southward getting started guide for a comprehensive introduction to deploying your showtime app. See Heroku CLI Commands for a full list of commands.
Staying Up to Date
The Heroku CLI keeps itself and its plugins (except linked plugins) up to date automatically, unless you installed the Debian/Ubuntu package or used npm install.
When you lot run a heroku command, a background process checks for the latest available version of the CLI. If a new version is found, it'southward downloaded and stored in ~/.local/share/heroku/client. This background cheque happens at most once every 4 hours.
The heroku binary checks for an up-to-date client in ~/.local/share/heroku/customer before using the originally installed client.
Latest Release SHAs
Darwin
- x64
Linux
- arm
- x64
Windows
- x64
- x86
Useful CLI Plugins
CLI plugins allow you to extend your CLI installation. Install a CLI plugin with heroku plugins:install someplugin. See Using CLI Plugins for more information on plugin management.
Here are some useful plugins:
- heroku-builds — View builds, purge the build cache, and create builds from tarballs.
- heroku-repo — Commands to dispense an app's Heroku git repository.
- api — Make advertizing-hoc API requests (such equally
heroku api GET /account). - heroku-pg-extras — Provides extra
heroku pg:*commands. - heroku-slugs — Downloads app slugs.
- heroku-kafka — Manage Heroku Kafka.
- heroku-guardian - View various configurations within Heroku that assistance secure your apps, spaces, and users.
- heroku-papertrail — Display, tail, and search for logs with Papertrail.
- avant-garde-scheduler — Create and manage your Advanced Scheduler triggers.
- heroku-cron — Create, manage and monitor your Cron To Get jobs using interactive command line or using manifest files in mail-deploy scripts.
CLI Architecture
The Heroku CLI is built with the Open CLI Framework (oclif), developed within Heroku / Salesforce. oclif is available equally a framework for any developer to build a large or a pocket-size CLI. The framework includes a CLI generator, automated documentation creation, and testing infrastructure.
The code for the Heroku CLI is also open source. Information technology does not require Node.js or any other dependencies to run. Unless y'all install the Debian/Ubuntu package or used npm install, the CLI contains its own Node.js binary that doesn't conflict with other applications.
Troubleshooting the Heroku CLI
If you're having bug with the CLI, ensure that you're using the latest version. If you lot're not, endeavor updating with heroku update.
Not all methods of installation support heroku update.
- If you installed the CLI with
apt, you must usesudo apt-get update && sudo apt-get upgrade heroku. - If you installed the CLI with
npmoryarn, yous must usenpm upgrade -m herokuoryarn global upgrade heroku.
If the CLI fails to update, try uninstalling information technology, then reinstalling it. Ensure that you don't have the legacy Heroku Toolbelt or Heroku Ruby-red gem installed by using which heroku or where heroku (on Windows) to confirm what the heroku control points to. Some users must modify their PATH to include it (/usr/local/bin/heroku for well-nigh installations).
If you're still encountering an issue, you lot can set the following debugging environs variables to help diagnose information technology:
| Surroundings Variable | Description |
|---|---|
HEROKU_DEBUG=1 | Shows debugging information mostly related to Heroku API interactions |
HEROKU_DEBUG_HEADERS=ane | Alongside HEROKU_DEBUG=1, shows HTTP headers |
DEBUG=* | Shows verbose debugging information |
You can too check the CLI's error logfile, stored at one of the following locations depending on your operating system:
| Bone | Location |
|---|---|
| macOS | ~/Library/Caches/heroku/error.log |
| Windows | %LOCALAPPDATA%\heroku\fault.log |
| Linux/Other | ~/.cache/heroku/error.log (or XDG_CACHE_HOME if fix) |
If you lot go on to have problems and the CLI is upward to appointment, or if updating fails for other reasons, reset the CLI by deleting its user directories. These directories get replaced automatically. Deleting them doesn't log y'all out but you lose whatever installed plugins.
Kickoff, run heroku plugins to list your installed plugins so you can brand sure to reinstall them.
Then, delete the following directories:
Windows:
-
%LOCALAPPDATA%\heroku
macOS/Linux/Other:
-
~/.local/share/heroku(orXDG_DATA_HOMEif set) - Either
~/Library/Caches/herokuon macOS, or~/.cache/herokuon Linux/Other (orXDG_CACHE_HOMEif prepare)
Login Problems
If you're experiencing issues with logging in, effort moving your .netrc file. This file is where the CLI stores credentials:
$ mv ~/.netrc ~/.netrc.backup $ heroku login On Windows, the file is named _netrc.
Homebrew-Specific Issues
If you go legacy warnings even with the latest homebrew version of heroku installed, the binary heroku command in your PATH environment variable isn't pointing to the version that brew installed.
First, run which heroku to see what binary heroku is pointing to. If it isn't /usr/local/bin/heroku, delete the binary it is pointing to. You can also make /usr/local/bin/ in a higher place in your PATH environment variable by modifying your ~/.bashrc file or equivalent.
Adjacent, run brew link --overwrite heroku to brand certain that /usr/local/bin/heroku is pointing to the new CLI. If yous continue to have trouble, run brew physician to bespeak out any bug with your organisation.
Apple Silicon Issues
If y'all're getting the following error on a automobile with an Apple tree M1 bit, you haven't installed or declined to install Rosetta 2.
Bad CPU type in executable
Installing Rosetta 2 resolves this outcome.
If you don't want to install Rosetta 2 on your auto, you can install the Heroku npm package globally and use your own Node binary locally. Merely v16 of Node has M1 ARM support and npm isn't the recommended install method.
Uninstall the Heroku CLI
This action also deletes all CLI plugins.
macOS
On macOS, y'all can uninstall the CLI by typing:
$ rm -rf /usr/local/heroku /usr/local/lib/heroku /usr/local/bin/heroku ~/.local/share/heroku ~/Library/Caches/heroku Homebrew Installs
If yous installed the Heroku CLI using Homebrew, y'all can uninstall the CLI by typing:
$ mash uninstall heroku $ rm -rf ~/.local/share/heroku ~/Library/Caches/heroku Linux
Standalone Install
For standalone installs, you can uninstall the CLI by typing:
$ rm /usr/local/bin/heroku $ rm -rf /usr/local/lib/heroku /usr/local/heroku $ rm -rf ~/.local/share/heroku ~/.enshroud/heroku Debian and Ubuntu Installs
For Debian/Ubuntu, you lot can uninstall the CLI by typing:
$ sudo apt-get remove heroku heroku-toolbelt $ sudo rm /etc/apt/sources.listing.d/heroku.list If you have $XDG_DATA_HOME, or $XDG_CACHE_HOME, it uses those variables instead of ~/.local/share, and ~/.cache.
You can remove the release key by running these commands:
$ sudo apt-fundamental list $ sudo apt-key del KEYFROMABOVE Windows
On Windows, to uninstall the Heroku CLI:
- Click
Start > Control Panel > Programs > Programs and Features. - Select
Heroku CLI, then clickUninstall. (Notation that the uninstaller is unsigned).
The Windows uninstaller is non automatically updated alongside the CLI. If it's been a while since you lot kickoff installed the CLI, manually install the latest version of the CLI to obtain an up-to-appointment uninstaller.
If the uninstall is unsuccessful, manually delete %LOCALAPPDATA%\heroku along with the directory in Program Files.
Uninstall the Legacy heroku Jewel
To observe out where the executable is, run which.
$ which heroku /usr/local/heroku/bin/heroku Ensure the path to the heroku command isn't in a Ruby gem directory.
If it is, uninstall it and whatever other heroku gems:
$ precious stone uninstall heroku --all Source: https://devcenter.heroku.com/articles/heroku-cli
Posted by: dvorakbefave.blogspot.com

0 Response to "How To Use Heroku Cli On Windows"
Post a Comment