doesn't recognize Powershell commands

Hi folks,
I noticed that doesn’t recognize very common Powershell commands like ConvertTo-Json or Invoke-RestMethod. Also it won’t let me create a PSCustomObject.
Are there any modules that I need to import first?
If yes, how?
Install-Module gives me an error aswell (as it’s obviously a Linux shell)

The Replit shell connects to Replit’s Linux machines behind the scenes. Powershell commands won’t work in a Linux environment. You could try adding pkgs.powershell to your replit.nix file and see if that works.

Edit: If you add pkgs.pash to your replit.nix file you can get PowerShell working, you can change your run command to pash main.ps1. There’s a community made PowerShell template which uses this.


@MattDESTROYER thanks for getting back!
That’s what is set when I create the repl with the powershell template.

Unfortunately, that didn’t work aswell, it still throws the same errors

1 Like

Remove the comma between "pash" and "main.ps1" and see if that works.
Change it to: run = "pash main.ps1"
As said above:

I changed the line but that didn’t work aswell.
No errors, just kind of an infinite loop (script not finishing).
Also, when I press stop, the button remains in “Stopping” until I reload the page.
I added 2 debug outputs, which aren’t executed, even the first write-host isn’t executed (which just outputs the variable).
So I guess there’s still something wrong with the run configuration.

Actually, an array like that works just fine.


Try creating a new Repl and searching searching Powershell to get that template then, because that seemed to work.

1 Like

That’s what I tried before.
Unfortunately with the same unsuccessful result.

Basic commands, like Write-Host, work fine but almost everything beyond that throws an error.