I get the error "/bin/sh: 1: powershell: not found" in visual Studio Code running on Ubuntu 18.04

Occasional Visitor

Hi,

I get the error "/bin/sh: 1: powershell: not found" in the OUTPUT tab in Visual Studio Code Version 1.53.0 when i try to run simple script in a new file which is open in the editor.

does the "which pwsh" output "/opt/microsoft/powershell/7/pwsh" have anything to do with this? Maybe the path.

 

"/bin/sh: 1: powershell: not found": See attached screenshot 1

 

And the PROBLEMS tab in Visual Studio code outputs: See attached screenshot 2

 

Secondly sometimes auto completion works inside the editor and sometimes it doesn't. For example typing " Write-Host" in the editor does not auto complete. I know "sometimes" is a strange concept in IT but its true in this case: See attached screenshot 3

 

some extra details:
PS /home/arend/.vscode/extensions/ms-vscode.powershell-2020.6.0/examples> which pwsh
/opt/microsoft/powershell/7/pwsh

PS /home/arend/.vscode/extensions/ms-vscode.powershell-2020.6.0/examples> $PSVersionTable
Name Value
PSVersion 7.1.1
PSEdition Core
GitCommitId 7.1.1
OS Linux 5.4.0-65-generic #73~18.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code
Version: 1.53.0
Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496
Date: 2021-02-03T15:56:04.185Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.4.0-65-generic

 

Do you have any idea?

 

 

 

 

1 Reply

Hi @arendkolk ,

 

I guess you should add symbolic link to the binaries, use this command and try again:

 

sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh

 

here is the article on how to install using direct download method:
installation-via-direct-download 

 

hope it helps!

Best Regards.