Vscode-terraform: "Unable to install terraform-ls"

Created on 24 Oct 2020  路  3Comments  路  Source: hashicorp/vscode-terraform

  • Installed newest (v2.2.3) version
  • Created directory with example files && terraform init (with v0.13.4)
  • Opened directory in VS Code
  • Error toast: Unable to install terraform-ls

Extension host log:

[2020-10-24 08:31:24.728] [exthost] [error] TypeError: Cannot read property 'url' of undefined
    at LanguageServerInstaller.<anonymous> (c:\Users\Marcus\.vscode\extensions\hashicorp.terraform-2.2.3\src\languageServerInstaller.ts:113:29)
    at Generator.next (<anonymous>)
    at c:\Users\Marcus\.vscode\extensions\hashicorp.terraform-2.2.3\out\languageServerInstaller.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (c:\Users\Marcus\.vscode\extensions\hashicorp.terraform-2.2.3\out\languageServerInstaller.js:4:12)
    at LanguageServerInstaller.installPkg (c:\Users\Marcus\.vscode\extensions\hashicorp.terraform-2.2.3\out\languageServerInstaller.js:98:16)
    at LanguageServerInstaller.<anonymous> (c:\Users\Marcus\.vscode\extensions\hashicorp.terraform-2.2.3\src\languageServerInstaller.ts:78:15)
    at Generator.next (<anonymous>)
    at fulfilled (c:\Users\Marcus\.vscode\extensions\hashicorp.terraform-2.2.3\out\languageServerInstaller.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)

Windows 10 1909

bug

Most helpful comment

fwiw, on Ubuntu 18.04 this issue disappeared after i simply removed the extension and re-installed it.

All 3 comments

For anyone who comes here like I did looking for the solution to this issue, you can work around this issue by installing the terraform-ls independently.

I believe my issue was that I was launching vscode from wsl2. At any rate, I was able to work around it by installing terraform-ls using the below command,

brew install hashicorp/tap/terraform-ls

This how to manually install it on Windows:

  • Download latest terraform-ls from https://releases.hashicorp.com/terraform-ls/
  • Unzip and copy the file to one of your user folders (ex. %USERPROFILE%\.terraform)
  • Add the following to the end of the settings.json vsCode config file:
    js "terraform.languageServer": { "external": true, "pathToBinary": "C:/Users/[USER_NAME]/.terraform/terraform-ls", "args": [ "serve" ] },

fwiw, on Ubuntu 18.04 this issue disappeared after i simply removed the extension and re-installed it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

QuinnStevens picture QuinnStevens  路  6Comments

visokoo picture visokoo  路  3Comments

vazkarvishal picture vazkarvishal  路  5Comments

chrisgallivan picture chrisgallivan  路  4Comments

brodster2 picture brodster2  路  5Comments