Why does Ubuntu WSL shows error when checking heroku version?

Viewed 295

I have heroku installed in C: drive. I also installed heroku in my Ubuntu WSL. When I try to check the heroku version it shows:

/mnt/c/Program Files/heroku/bin/../client/bin/heroku.cmd: 1: @echo: not found 
/mnt/c/Program Files/heroku/bin/../client/bin/heroku.cmd: 2: setlocal: not found 
/mnt/c/Program Files/heroku/bin/../client/bin/heroku.cmd: 4: Syntax error: "(" unexpected (expecting "then")

I tried to push inside my code folder in command prompt.

git push heroku main
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
2 Answers

It looks like you're trying to run a batch script (for cmd.exe) in your Linux shell (likely bash unless you've changed it). That's not going to work.

It's possible to run Windows .exe files in WSL, but I don't think there's a heroku.exe in the Windows version. I suggest you install the Linux version right in WSL and use that instead.

Try to use sudo heroku --version this force the system to use Heroku from WSL2 instead of windows, I strongly recommend to delete any instance of Herku CLI in windows when using Heroku CLI in WSL2.

Related