vscode-elixir-ls: Extension fails to load after upgrade to v0.6.0

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.10.3, Erlang/OTP 22
  • VSCode ElixirLS version: v0.6.0
  • Operating System Version: Linux (Ubuntu 16.04)

Troubleshooting

  • Restart your editor (which will restart ElixirLS) sometimes fixes issues
  • Stop your editor, remove the entire .elixir_ls directory, then restart your editor
  1. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? If not, please publish a repo on Github that does reproduce it.
  2. Check the output log by opening View > Output and selecting “ElixirLS” in the dropdown. Please include any output that looks relevant. (If ElixirLS isn’t in the dropdown, the server failed to launch.)
  3. Check the developer console by opening Help > Toggle Developer Tools and include any errors that look relevant.

Description

The extension fails to properly load after upgrading to v0.6.0. Syntax highlighting works but other features like autocompletion, navigation, deps fetching and PLT build do not work and the extension does not appear in the dropdown under View > Output.

A Cannot find module 'shelljs' error is printed in the DevTools console. elixir_ls

elixir_ls

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 16 (2 by maintainers)

Most upvoted comments

temporary solution, run npm i in ~/.vscode/extensions/jakebecker.elixir-ls-0.6.0

Sorry about this! After investigating it looks like there were two issues, one was that I was hit by https://github.com/microsoft/vscode-vsce/issues/494 which caused the extension to not start because the dependencies were not installed. This issue could be worked around with https://github.com/elixir-lsp/vscode-elixir-ls/issues/145#issuecomment-703249412

The second issue was that I built the package with Elixir 1.10, and that caused the extension to not run on any project using an earlier elixir version which caused the function ElixirLS.LanguageServer.CLI.main/0 is undefined error.

But the good new is that I just released v0.6.1 that fixes both those issues. Didn’t make a PR but this is the commit that bumps the version and adds a reminder to use the .release-tool-versions when publishing the extension: https://github.com/elixir-lsp/vscode-elixir-ls/commit/6ef324bbb9ed0e1889eca9471bfec57f4a60ce6a

🆗 I found this issue https://github.com/microsoft/vscode-vsce/issues/494 to confirm that it’s bug from vsce

I’ve also been experiencing this issue today. I tried @AidasPa’s temporary workaround. But, like other commenters, I ran into issues when ElixirLS would start up.

I think I’ve identified a temporary workaround that does indeed work, based on @iporsut’s comments that this is ultimately a vsce bug.

Steps:

  1. Clone vscode-elixir-ls locally. Ensure the symlinked elixir-ls repo is also cloned to your local machine.
  2. Install dependencies: npm install
  3. Package the extension: npx vsce package --no-yarn
  4. Install the packaged extension to your VSCode instance: code --install-extension elixir-ls-0.6.0.vsix

For more info, see the Packaging extensions guide from the VSCode docs.

@bceskavich 's Solution works but the LS does not start for an umbrella project, though working for a non-umbrella project. Crashes with

[Info - 10:05:32 PM] Connection to server got closed. 
Server will restart. ** (UndefinedFunctionError) function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available) ElixirLS.LanguageServer.CLI.main() (stdlib 3.11.2) erl_eval.erl:680: :erl_eval.do_apply/6 (elixir 1.10.0) lib/code.ex:332: Code.eval_string_with_error_handling/3 
[Info - 10:05:33 PM] Connection to server got closed. Server will restart. 
** (UndefinedFunctionError) function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available) ElixirLS.LanguageServer.CLI.main() (stdlib 3.11.2) erl_eval.erl:680: :erl_eval.do_apply/6 (elixir 1.10.0) lib/code.ex:332: Code.eval_string_with_error_handling/3 
[Error - 10:05:33 PM] Connection to server got closed. Server will not be restarted.

@AidasPa 's Installing ~/.vscode/extensions/jakebecker.elixir-ls-0.6.0 also did not work for me, led to some other error.

I resorted to the previous version. I will just try an update after the fix is made 😄 Screenshot 2020-10-04 at 22 16 51

Seem like vsce 1.81.0 detected to useYarn in this project. So it doesn’t get npm dependencies. We have to force it that not use yarn by vsce package --no-yarn.

@AidasPa that temporary solution worked for me! Thanks.

I’m experiencing the same. This is the error I’m getting:

[2020-10-04 06:48:35.485] [exthost] [error] Activating extension JakeBecker.elixir-ls failed due to an error: [2020-10-04 06:48:35.486] [exthost] [error] Error: Cannot find module ‘shelljs’ Require stack:

  • /root/.vscode-server/extensions/jakebecker.elixir-ls-0.6.0/out/extension.js
  • /root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/loader.js
  • /root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/bootstrap-amd.js
  • /root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/bootstrap-fork.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17) at Function.Module._load (internal/modules/cjs/loader.js:686:27) at Function.t._load (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1070:268) at Function.i._load (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1039:981) at Function.n._load (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1036:303) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.<anonymous> (/root/.vscode-server/extensions/jakebecker.elixir-ls-0.6.0/out/extension.js:10:15) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Function.t._load (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1070:268) at Function.i._load (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1039:981) at Function.n._load (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1036:303) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Function.s [as __$__nodeRequire] (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/loader.js:33:604) at p._loadCommonJSModule (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1041:241) at p._doActivateExtension (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:939:625) at p._activateExtension (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:938:708) at Object.actualActivateExtension (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:936:453) at h._activateExtension (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:668:731) at /root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:668:409 at Array.map (<anonymous>) at h._activateExtensions (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:668:397) at h.activateByEvent (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:665:919) at p._activateByEvent (/root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:937:300) at /root/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:946:242 at processTicksAndRejections (internal/process/task_queues.js:94:5)