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

Created on 5 Feb 2021  路  2Comments  路  Source: PowerShell/vscode-powershell

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.

image

And the PROBLEMS tab outputs:
image

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.

image

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

Needs-Repro-Info Resolution-Fixed

Most helpful comment

Thanks @arendkolk

when i try to run simple script in a new file which is open in the editor.

How are you running the file? Generally the PowerShell extension doesnt print in the output window and it looks like even though the extension has picked up pwsh, something else if making an assumption about powershell rather than pwsh being the thing to execute.

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.

Do you see this issue "sometimes" as in sometimes with the same commands/files but say on different days, or sometimes as in some file/with some commands but not others?

It would also be great to know if you have any settings related to the PowerShell path/version in VSCode?

Thanks!

All 2 comments

Thanks @arendkolk

when i try to run simple script in a new file which is open in the editor.

How are you running the file? Generally the PowerShell extension doesnt print in the output window and it looks like even though the extension has picked up pwsh, something else if making an assumption about powershell rather than pwsh being the thing to execute.

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.

Do you see this issue "sometimes" as in sometimes with the same commands/files but say on different days, or sometimes as in some file/with some commands but not others?

It would also be great to know if you have any settings related to the PowerShell path/version in VSCode?

Thanks!

Hi Sydney, Thank you for your reply. I have uninstalled and reinstalled Visual Studio Code (now via snap) and now the hanging is gone.

Visual Studio Code seemed to be hanging in the background (the little wheel in the left bottom kept spinning) but now finally i get the proper action popping up:

" WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code to authenticate. "

cheers,

Arend

Was this page helpful?
0 / 5 - 0 ratings