Vscode: extension installation using CLI leads to UnhandledPromiseRejectionWarning and hangs

Created on 12 Aug 2017  路  21Comments  路  Source: microsoft/vscode

Installing any extension, using code CLI, like

code --install-extension EditorConfig.EditorConfig

leads to the following message and the command hangs
Found 'EditorConfig.EditorConfig' in the marketplace. Installing... (node:16346) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: this._state.then is not a function (node:16346) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

  • VSCode Version: 1.15
  • OS Version: Ubuntu 17.04, Fedora 26

Extensions can be installed from within the editor, without any problem.

bug extensions verified

Most helpful comment

@joaomoreno seems like vscode not publish new version at the end of August? We still waiting for this bugfix.

All 21 comments

Same problem on Windows 10 too.

Same problem on macOS Sierra 10.12.6 and VSCode 1.15

I have the same problem with @gperdomor

I have this too, how to fix it?

code -v
1.15.0
8b95971d8cccd3afd86b35d4a0e098c189294ff2

node -v
v6.3.0

npm -v
3.10.3

macOS Sierra 10.12.4 (16E195)

Any ideas?

+1

Same problem on macOS Sierra 10.12.6 and VSCode 1.15.1

Same issue.

VS Code version info from About (latest):
Version 1.15.1
Commit 41abd21afdf7424c89319ee7cb0445cc6f376959
Date 2017-08-16T17:16:27.618Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
Architecture x64

node --version
v8.4.0
npm --version
5.3.0

OS is latest x64 Kali linux.

I have three plugins, and they all fail! The editor doesn't even start. Very disappointing! :-1:

Any one is dealing with it? I believe it's a bug...

Same problem on
Mint 18.2 (ubuntu 16.04 based),
vscode 1.15,
node v6.11.2
npm 3.10.10

I'm seeing the same with

  • VSCode Version: 1.15.1 41abd21
  • OS Version: macOS 10.10.5 (14F2511)

Sorry for that guys. Current workaround is to install extensions through the UI.

cc @jrieken Issue appeared with e1506992b62c222f3f9f9e38d405b7de41159808 :cry:

ops

Hi @joaomoreno , I'm SDE at Microsoft work for IoT DevKit https://microsoft.github.io/azure-iot-developer-kit/

We have published one-click install script to help developers to setup dev environment, including install vscode and arduino extension. https://microsoft.github.io/azure-iot-developer-kit/docs/get-started/

To install extension with CLI is an important step in our installation script, and this issue may break our script.

Could you please tell us more information about when this issue will be fixed? To our one-click script, we have no workaround currently. Thanks.

This issue is fixed now in master and the fix will be released at the end of the month.

@Sneezry - agree this was an unfortunate hiccup as I was trying to get started with my IoT dev board. I ended up having to install the cpp extension manually, then commented out a line from outcli.js (//'installCppExtension') and hopefully I'm back to green. Looking forward to the code fix release.

I found one workaround(at-least worked for me :) )
My system is behind proxy but everything working fine before upgrading to 1.15.1(proxy settings is configured)
I tried both installing through _Extension UI_ and _install from vsix file_, it failed without error. Installing by command line throwing the same error mentioned in this thread.

Whats worked is:

Step 1: Install through command line (It will fail)
Step 2: Once it failed, install the same through UI

@amiteshhh this issue is only related with installing extensions from marketplace with CLI. Both installing from GUI or local vsix file are okay.

I'm having the same issue with v 1.15.1.

Though it is possible to use code --install-extension {path/to/package.vsix} to install a package from the command line. Which is useful if you're trying to install the same extensions for multiple users.

$name = "publisher.package"

$pattern = "<script class=`"vss-extension`" defer=`"defer`" type=`"application\/json`">(.*?)<\/script>"
$regex = [regex]"(?m)$pattern"
$dom = (New-Object Net.WebClient).DownloadString("https://marketplace.visualstudio.com/items?itemName=$name");


  if($dom -and $dom -match $pattern) {
       $matches = $regex.Match($dom)
       $jsonText = $matches[0].Groups[1]

       $json = ConvertFrom-Json $jsonText

       $version = $Json.versions[0].version
       $parts = $name.Split(".")
       $publisher = $parts[0]
       $package = $parts[1]

       $packageUrl = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/$publisher/vsextensions/$package/$version/vspackage"

    Write-Host "vscode: install $name"
    Write-Host "----------------------------------------"
    Invoke-RestMethod -Method Get -Uri $packageUrl -OutFile "$Env:Temp\$name.vsix" 
    code --install-extension "$Env:Temp\$name.vsix"
    Write-Host ""
}

The code above could use more defense coding, however, its to demonstrate that you can do the following:

  • grab the home page of the extension
  • parse the json in the page for the latest version number
  • assemble the url for the vsix package
  • download the vsix package.
  • install it from the command line.

@joaomoreno seems like vscode not publish new version at the end of August? We still waiting for this bugfix.

Was this page helpful?
0 / 5 - 0 ratings