9

Trying to setup Heroku CLI to work with WSL.

Starting by following the directions here for Ubuntu 16+:

https://devcenter.heroku.com/articles/heroku-cli

sudo snap install --classic heroku

Produces the following error:

error: cannot communicate with server: Post http://localhost/v2/snaps/heroku: dial unix /run/snapd.socket: connect: no such file or directory

Googled the error and came across this thread:

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1631514

I tried systemctl status snapd.service, which just says the following:

System has not been booted with systemd as init system (PID 1). Can't operate.

Restart WSL and the computer and same issue.

Thought maybe snapd wasn't installed because typing snap or snapd says Command '____' not found, did you mean:.... But trying to do sudo apt-get install snapd says that it is already the latest version.

21

Nope, doesn't sound like there is current support in WSL for snap. snapd, nor systemd. Thankfully there is a manual install provided by Heroku, so will give that a shot.

This worked in my case:

curl https://cli-assets.heroku.com/install.sh | sh

| improve this answer | |
  • 1
    Do note that sudo applies to individual commands, not to the whole pipeline. curl | sudo sh makes sense (if a bit dangerous), sudo curl | sh is useless. – user1686 Jan 6 '19 at 18:10
  • No superuser permissions required, tested on WSL and working fine. – Juanjo Salvador Oct 12 '19 at 0:08
  • Mine just asked for credentials where needed :) You probably set up a password or choose to omit it when you first set up WSL I imagine. At the end of the install though it did complain about: [EACCES] Error Plugin: heroku: EACCES: permission denied, mkdir '/home/coder/.cache/heroku' – CTS_AE Apr 20 at 11:04
  • I ended up having to run the following to get the heroku cli happy and not throwing those errors I listed in my last comment: sudo chmod -R 0777 ~/.cache/heroku – CTS_AE Apr 20 at 11:19
  • On WSL2 I get the following error: gpg: can't connect to the agent: IPC connect call failed – user26631 Jun 10 at 10:21
0

It's not a great solution, and requires context switching, but you can install the Heroku cli in Windows and do your pushes/Heroku cli interactions from the Windows interface.

| improve this answer | |
0

voted answer did work but first had to do the following

first enable virtual machine platform

enter image description here

then had to update default version for wsl by running the following in ps (for me was in ps 7)

wsl --set-default-version 2

then i was able to run the following in ubuntu bash

curl https://cli-assets.heroku.com/install.sh | sh

and all works so far

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.