Skip to content

Language server startup failed: PowerShellEditorServices missing. #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
deathly809 opened this issue May 22, 2017 · 12 comments
Closed

Language server startup failed: PowerShellEditorServices missing. #775

deathly809 opened this issue May 22, 2017 · 12 comments
Labels
Issue-Bug A bug to squash. OS-Linux

Comments

@deathly809
Copy link

System Details

  • Operating system name and version:
    Ubuntu 16.04

  • VS Code version:
    1.12.2

  • PowerShell extension version:
    1.1.0

  • Output from $PSVersionTable:
    Name Value


PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.14
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Copy / paste the below commands into the PowerShell Integrated Terminal, and paste the output here

code -v
1.12.2
19222cdc84ce72202478ba1cec5cb557b71163de

$pseditor.EditorServicesVersion
Nothing

code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

$PSVersionTable
Name                           Value                                                                                                                                                                               
----                           -----                                                                                                                                                                               
PSVersion                      6.0.0-alpha                                                                                                                                                                         
PSEdition                      Core                                                                                                                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                             
BuildVersion                   3.0.0.0                                                                                                                                                                             
GitCommitId                    v6.0.0-alpha.14                                                                                                                                                                     
CLRVersion                                                                                                                                                                                                         
WSManStackVersion              3.0                                                                                                                                                                                 
PSRemotingProtocolVersion      2.3                                                                                                                                                                                 
SerializationVersion           1.1.0.1 

Issue Description

When I start up VSCode the Powershell Language Server fails to load. There is an error message in the 'PowerShell Integrated Terminal" but it is erased before I can read it. I took a screenshot of this error (after many attempts) and attached in zip file. There is no useful error message in the logs, maybe this should be fixed (another bug report?).

Attached Logs

BugReport.zip

@daviwil
Copy link
Contributor

daviwil commented May 22, 2017

Thanks @deathly809! Sorry for the trouble with getting that error message, the terminal is supposed to stay open for a bit on error so that you can copy it. I think I missed a case in the startup script which didn't catch this error case.

Can you give me the output of running these commands in PowerShell outside of VS Code:

gci $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules
Get-Module -ListAvailable $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules/PowerShellEditorServices/PowerShellEditorServices.psd1
Get-Module -ListAvailable

@deathly809
Copy link
Author

gci $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules

gci : Cannot find path '/home/jeffrey/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules' because it does not exist.
At line:1 char:1
+ gci $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (/home/jeffrey/....l-1.1.0/modules:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Get-Module -ListAvailable $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules/PowerShellEditorServices/PowerShellEditorServices.psd1

    Directory: /home/jeffrey/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules


ModuleType Version    Name                                ExportedCommands                                                                                                                                         
---------- -------    ----                                ----------------                                                                                                                                         
Manifest   0.0        PowerShellEditorServices                                   

Get-Module -ListAvailable

    Directory: /home/jeffrey/.local/share/powershell/Modules


ModuleType Version    Name                                ExportedCommands                                                                                                                                         
---------- -------    ----                                ----------------                                                                                                                                         
Script     3.3.9      InvokeBuild                         {Invoke-Build, Invoke-Builds}                                                                                                                            


    Directory: /opt/microsoft/powershell/6.0.0-alpha.14/Modules


ModuleType Version    Name                                ExportedCommands                                                                                                                                         
---------- -------    ----                                ----------------                                                                                                                                         
Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}                                                                                                                       
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                                                                                                                      
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}                                                                                           
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, ConvertFrom-SecureString...}                                                                  
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}                                                                                               
Script     1.1.2.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                                                   
Script     3.3.9      Pester                              {Describe, Context, It, Should...}                                                                                                                       
Script     1.1.2.0    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                                                                                             
Script     0.0        PSDesiredStateConfiguration         {IsHiddenResource, StrongConnect, Write-MetaConfigFile, Get-InnerMostErrorRecord...}                                                                     
Script     1.2        PSReadLine                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-PSReadlineKeyHandler, Get-PSReadlineOption...}                                               


@daviwil
Copy link
Contributor

daviwil commented May 22, 2017

Something is wrong here, the modules folder should not be empty. How did you install the extension, via the VS Code Extensions pane? Can you give me the output of this command:

gci $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/

@deathly809
Copy link
Author

I installed through VSCode.

I see the problem, it is lowercase on Linux (powershell, not PowerShell). Here is the original command with lowercase PowerShell

    Directory: /home/jeffrey/.vscode/extensions/ms-vscode.powershell-1.1.0/modules


Mode                LastWriteTime         Length Name                                                                                                                                                              
----                -------------         ------ ----                                                                                                                                                              
d-----          5/21/17  11:59 AM                Plaster                                                                                                                                                           
d-----          5/21/17  11:59 AM                PowerShellEditorServices                                                                                                                                          
d-----          5/21/17  11:59 AM                PSScriptAnalyzer                                                                                                                                                  
------          5/21/17  11:59 AM            370 README.md                                                                                                                                                         


@daviwil
Copy link
Contributor

daviwil commented May 22, 2017

Hmmm, that's strange, I wonder if VS Code changed how they deal with paths when they install extensions. Thanks for pointing this out, I'll try to get it fixed soon!

@daviwil
Copy link
Contributor

daviwil commented May 22, 2017

By the way, was this working for you successfully in the past or is this the first time you've tried to use VS Code and the PowerShell extension on Ubuntu?

@daviwil daviwil added this to the 1.2.0 milestone May 22, 2017
@deathly809
Copy link
Author

I have only just started using it and I don't recall it ever working.

@lennyi
Copy link

lennyi commented May 23, 2017

I believe I'm having a similar issue on OS X 10.12.5.

> code -v
1.12.2
19222cdc84ce72202478ba1cec5cb557b71163de

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.15
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

The language service fails to initialize with the following error:

[18:10:39] Language server starting...
powershell.exe started --
    pid: 6638
    exe: /usr/local/bin/powershell
    args: /Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/scripts/Start-EditorServices.ps1 -EditorServicesVersion '1.1.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.1.0' -BundledModulesPath '/Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath '/Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/logs/1495494639-7f30055a-a94f-440a-82d8-b65de35598461495494607366/EditorServices.log' -SessionDetailsPath '/Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/sessions/PSES-VSCode-6535-612054' -FeatureFlags @()



powershell.exe terminated or terminal UI was closed

[18:11:39] Language server startup failed.
Could not start language service: 
Timed out waiting for session file to appear.

I've had this behavior since I installed the extension a few weeks back and just now got around to troubleshooting it. When I run the Start-EditorServices.ps1 script from my terminal this is my output:

> /Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/scripts/Start-EditorServices.ps1 -EditorServicesVersion '1.1.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.1.0' -BundledModulesPath '/Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath '/Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/logs/1495494639-7f30055a-a94f-440a-82d8-b65de35598461495494607366/EditorServices.log' -SessionDetailsPath '/Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/sessions/PSES-VSCode-6535-612054' -FeatureFlags @()
needs_install
Import-Module : The specified module 'PowerShellEditorServices' with version '1.1.0' was not loaded because no valid module file
was found in any module directory.
At /Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/scripts/Start-EditorServices.ps1:208 char:5
+     Import-Module PowerShellEditorServices -RequiredVersion $parsedVe ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (PowerShellEditorServices:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleWithVersionNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Output from Get-module:

> gci $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules


    Directory: /Users/jondoe/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----          5/22/17   6:09 PM                Plaster
d-----          5/22/17   6:09 PM                PowerShellEditorServices
d-----          5/22/17   6:09 PM                PSScriptAnalyzer
------          5/22/17   6:09 PM            370 README.md

> Get-Module -ListAvailable $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules/PowerShellEditorServices/PowerShellEditorServices.psd1


    Directory: /Users/jondoe/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.0      PowerShellEditorServices            {Start-EditorServicesHost, Get-PowerShellEditorServicesVersion, Compre...


> get-module -ListAvailable


    Directory: /Users/jondoe/.local/share/powershell/Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.21       PowerCLI.Vds
Binary     1.21       PowerCLI.ViCore                     HookGetViewAutoCompleter


    Directory: /usr/local/microsoft/powershell/6.0.0-alpha.15/Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, ConvertFrom...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}
Script     1.1.2.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     3.3.9      Pester                              {Describe, Context, It, Should...}
Script     1.1.2.0    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     0.0        PSDesiredStateConfiguration         {StrongConnect, IsHiddenResource, Write-MetaConfigFile, Get-InnerMostE...
Script     1.2        PSReadLine                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-PSReadline...

Notice in the output for the Start-EditorServices.ps1 script it said needs_install. If I pass the -ConfirmInstall flag to the script, I get the following output:

Install-Module : Administrator rights are required to install modules in '/usr/local/microsoft/powershell/6.0.0-alpha.15/Modules'.
Log on to the computer with an account that has Administrator rights, and then try again, or install
'/Users/jondoe/.local/share/powershell/Modules' by adding "-Scope CurrentUser" to your command. You can also try running the
Windows PowerShell session with elevated rights (Run as Administrator).
At /Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/scripts/Start-EditorServices.ps1:198 char:9
+         Install-Module "PowerShellEditorServices" -RequiredVersion $p ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ArgumentException
    + FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module

Import-Module : The specified module 'PowerShellEditorServices' with version '1.1.0' was not loaded because no valid module file
was found in any module directory.
At /Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/scripts/Start-EditorServices.ps1:208 char:5
+     Import-Module PowerShellEditorServices -RequiredVersion $parsedVe ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (PowerShellEditorServices:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleWithVersionNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

If I edit the script and add the -Scope CurrentUser to the Install-Module command, I get the following output:

PackageManagement\Install-Package : No match was found for the specified search criteria and module name
'PowerShellEditorServices'. Try Get-PSRepository to see all available registered module repositories.
At /usr/local/microsoft/powershell/6.0.0-alpha.15/Modules/PowerShellGet/1.1.2.0/PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Import-Module : The specified module 'PowerShellEditorServices' with version '1.1.0' was not loaded because no valid module file
was found in any module directory.
At /Users/jondoe/.vscode/extensions/ms-vscode.powershell-1.1.0/scripts/Start-EditorServices.ps1:208 char:5
+     Import-Module PowerShellEditorServices -RequiredVersion $parsedVe ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (PowerShellEditorServices:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleWithVersionNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Output for Get-PSRepository:

> Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2/

I'm puzzled as to why PowerShell is not honoring the $env:PSModulePath environment variable you're setting.

In any case, I was able to get the language service to load by making the following changes:

$pathToModule = "$HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules/PowerShellEditorServices/PowerShellEditorServices.psd1"
if ((Test-ModuleAvailable $pathToModule -RequiredVersion $parsedVersion) -eq $false) {
    if ($ConfirmInstall -and $isPS5orLater) {
        # TODO: Check for error and return failure if necessary
        Install-Module "PowerShellEditorServices" -RequiredVersion $parsedVersion -Confirm -Scope CurrentUser
    }
    else {
        # Indicate to the client that the PowerShellEditorServices module
        # needs to be installed
        Write-Output "needs_install"
    }
}

if ($isPS5orLater) {
    Import-Module $pathToModule -RequiredVersion $parsedVersion -ErrorAction Stop
}
else {
    Import-Module $pathToModule -Version $parsedVersion -ErrorAction Stop
}

Specifically, I'm passing the path to the module into the Test-ModuleAvailable and Import-Module function calls.

One issue I'm still experiencing is that the integrated console does not load on the first attempt; it just hangs indefinitely. I have to Restart Current Session to get it to load.

Hope this helps in correcting the issue permanently.

@daviwil
Copy link
Contributor

daviwil commented May 23, 2017

Ahh! Sorry guys, I just realized what the problem is. You both need to upgrade to PowerShell 6.0.0-alpha.18 or higher. I'd recommend 6.0.0-beta.1. Once you install that version of PowerShell everything should start working.

@daviwil
Copy link
Contributor

daviwil commented May 24, 2017

Closing this issue for now since I think a PowerShell Core upgrade fixes the issue. If this is not the case, let me know and I'll reopen for investigation. Thanks!

@daviwil daviwil closed this as completed May 24, 2017
@daviwil daviwil removed this from the 1.2.0 milestone May 31, 2017
@AJDulk
Copy link

AJDulk commented Jul 18, 2019

I am having this same issue using the following version:

PSVersion 6.2.2
PSEdition Core
OS Linux 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019
gci $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules                                                                             
gci : Cannot find path '/home/antony/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules' because it does not exist.

Get-Module -ListAvailable $HOME/.vscode/extensions/ms-vscode.PowerShell-1.1.0/modules/PowerShellEditorServices/PowerShellEditorServices.psd1
Manifest   0.0        PowerShellEditorServices            Desk      

Get-Module -ListAvailable
8< Azure Modules >8
Directory: /opt/microsoft/powershell/6/Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Manifest   1.2.3.0    Microsoft.PowerShell.Archive        Desk      {Compress-Archive, Expand-Archive}
Manifest   6.1.0.0    Microsoft.PowerShell.Host           Core      {Start-Transcript, Stop-Transcript}
Manifest   6.1.0.0    Microsoft.PowerShell.Management     Core      {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path…}
Manifest   6.1.0.0    Microsoft.PowerShell.Security       Core      {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, ConvertFrom-SecureString…}
Manifest   6.1.0.0    Microsoft.PowerShell.Utility        Core      {Export-Alias, Get-Alias, Import-Alias, New-Alias…}
Script     1.3.2      PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script     2.1.3      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
Script     0.0        PSDesiredStateConfiguration         Desk      {ValidateUpdate-ConfigurationData, ConvertTo-MOFInstance, GetCompositeResource, ValidateNoCircleInNodeResources…}
Script     2.0.0      PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption…}
Binary     1.1.2      ThreadJob                           Desk      Start-ThreadJob

I have just installed the following version of the script:
v2019.5.0 from Friday, May 24, 2019

@TylerLeonhardt
Copy link
Member

Thanks for the info @AJDulk can you open a new issue (easier for us, to track) and
attach the logs so we can get a better idea of what's going on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. OS-Linux
Projects
None yet
Development

No branches or pull requests

5 participants