Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97387

Can't initialize PowerShell session in VSCode for Mac

$
0
0

Briefly, I installed PowerShell via Homebrew. Then I installed the extension in VSCode (also restarted VSCode). When VSCode picks up that I'm working on a PowerShell script it tries to start a PowerShell session. (PowerShell integrated terminal)

PowerShell Integrated Console

An error occurred while starting PowerShell Editor Services:

The term 'chmod' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()

I get that chmod means something somewhere is trying to change some file permission. But I have no idea what it is. Maybe I can change the permissions myself and then PowerShell will finally start?

If I look at the extension logs I have this:

1/20/2020 9:54:39 AM [NORMAL] - Visual Studio Code v1.41.1 64-bit
1/20/2020 9:54:39 AM [NORMAL] - PowerShell Extension v2020.1.0
1/20/2020 9:54:39 AM [NORMAL] - Operating System: MacOS 64-bit
1/20/2020 9:54:39 AM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
1/20/2020 9:54:39 AM [NORMAL] - Language server starting --
1/20/2020 9:54:39 AM [NORMAL] -     exe: /usr/local/bin/pwsh
1/20/2020 9:54:39 AM [NORMAL] -     args: /Users/me/.vscode/extensions/ms-vscode.powershell-2020.1.0/modules/PowerShellEditorServices/Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.1.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/Users/me/.vscode/extensions/ms-vscode.powershell-2020.1.0/modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath '/Users/me/.vscode/extensions/ms-vscode.powershell-2020.1.0/logs/1579532079-da336a1a-b41b-4ae4-8d54-c10e5e98d3fc1579532032267/EditorServices.log' -SessionDetailsPath '/Users/me/.vscode/extensions/ms-vscode.powershell-2020.1.0/sessions/PSES-VSCode-72218-307401' -FeatureFlags @()
1/20/2020 9:54:40 AM [NORMAL] - powershell.exe started, pid: 13196
1/20/2020 9:56:39 AM [NORMAL] - Language server startup failed.
1/20/2020 9:56:39 AM [ERROR] - The language service could not be started: 
1/20/2020 9:56:39 AM [ERROR] - Timed out waiting for session file to appear.
1/20/2020 9:59:47 AM [NORMAL] - powershell.exe terminated or terminal UI was closed

I do see in the logs my powerShellExePath is blank, but I don't have any idea what to set that up as (or if that's the issue).

PowerShell by itself works fine. If in the terminal I punch in pwsh path/to/file/helloWorld.ps1 it will run and print out as expected.

Any ideas appreciated.

UPDATE:

Here is the output of my path when inside Powershell.

 frankie@mbp-frankie  ~  pwsh                                                                                                                      ✔  3739  11:26:25
PowerShell 6.2.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /Users/frankie > echo $env:PATH
/usr/local/microsoft/powershell/6:
/Users/frankie/Library/Android/sdk/tools:
/Users/frankie/Library/Android/sdk/platform-tools:
/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin:
/Users/frankie/anaconda3/bin:
/Users/frankie/anaconda3/condabin:
/Users/frankie/google-cloud-sdk/bin:
/Library/Frameworks/Python.framework/Versions/3.6/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/share/dotnet:
~/.dotnet/tools

The issue seems to specifically be with the PowerShell Integrated Console which might be a VSCode specific thing? I now noticed I'm able to successfully install the extension and start the session in Azure Data Studio with no errors. I'd still like to get this working specifically in VSCode though.

enter image description here

Unfortunately, changing the default shall to bash does not change the outcome.

enter image description here


Viewing all articles
Browse latest Browse all 97387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>