Skip to content
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

Extension fails to load after upgrade to v0.6.0 #145

Closed
2 tasks done
cmuhire opened this issue Oct 4, 2020 · 16 comments
Closed
2 tasks done

Extension fails to load after upgrade to v0.6.0 #145

cmuhire opened this issue Oct 4, 2020 · 16 comments

Comments

@cmuhire
Copy link

cmuhire commented Oct 4, 2020

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

@jeramyRR
Copy link

jeramyRR commented Oct 4, 2020

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. (/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 ()
    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)

@iporsut
Copy link

iporsut commented Oct 4, 2020

I think it's about vsce wrong version that compatible with currently of extension.

I try to manual package with npx vsce package it will used vsce version 1.75.0. Then install it manually it doesn't have above error.

But when I use vsce version 1.81.0 from global npm install -g vsce to package and install manually I found same error above.

@iporsut
Copy link

iporsut commented Oct 4, 2020

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.

@crbelaus
Copy link
Contributor

crbelaus commented Oct 4, 2020

Ouch. I've experienced the same bug and created issue elixir-lsp/elixir-ls#372. Since this is an error related to the VSCode extension itself I am closing that issue.

@iporsut
Copy link

iporsut commented Oct 4, 2020

🆗 I found this issue microsoft/vscode-vsce#494 to confirm that it's bug from vsce

@cmuhire
Copy link
Author

cmuhire commented Oct 4, 2020

I'm not sure that the issue is due to vsce version, it may rather be with the publishing stage.

The extension that I packaged locally with latest vsce version does include a node_modules folder (left pane in screenshot below) and loads fine when installed, but the one downloaded from the marketplace does not include a node_modules folder (right pane in screenshot below) which is why the shelljs module can't be found.
elixir_ls_diff

@axelson making sure the node_modules folder is included in the next published version should fix the issue.

P.S: worth considering using Webpack in the future to produce a single, slimmer bundle as recommended here https://code.visualstudio.com/api/working-with-extensions/bundling-extension
elixir_ls_suggestion

@hqnna
Copy link

hqnna commented Oct 4, 2020

Can confirm, it's broken for me as well

[2020-10-04 08:22:40.840] [exthost] [error] Activating extension JakeBecker.elixir-ls failed due to an error:
[2020-10-04 08:22:40.843] [exthost] [error] Error: Cannot find module 'shelljs'
Require stack:
- /home/pyxel/.vscode-server/extensions/jakebecker.elixir-ls-0.6.0/out/extension.js
- /home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/loader.js
- /home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/bootstrap-amd.js
- /home/pyxel/.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 (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1070:268)
	at Function.i._load (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1039:981)
	at Function.n._load (/home/pyxel/.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> (/home/pyxel/.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 (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1070:268)
	at Function.i._load (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1039:981)
	at Function.n._load (/home/pyxel/.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] (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/loader.js:33:604)
	at p._loadCommonJSModule (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:1041:241)
	at p._doActivateExtension (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:939:625)
	at p._activateExtension (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:938:708)
	at Object.actualActivateExtension (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:936:453)
	at h._activateExtension (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:668:731)
	at /home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:668:409
	at Array.map (<anonymous>)
	at h._activateExtensions (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:668:397)
	at h.activateByEvent (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:665:919)
	at p._activateByEvent (/home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:937:300)
	at /home/pyxel/.vscode-server/bin/2af051012b66169dde0c4dfae3f5ef48f787ff69/out/vs/server/remoteExtensionHostProcess.js:946:242
	at processTicksAndRejections (internal/process/task_queues.js:94:5)```

@AidasPa
Copy link

AidasPa commented Oct 4, 2020

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

@supercodepoet
Copy link

@AidasPa that temporary solution worked for me! Thanks.

@aleury
Copy link

aleury commented Oct 4, 2020

I tried @AidasPa's solution and am now seeing these logs in the ElixirLS output:

No which executable found for nodejs 10.16.3
No which executable found for nodejs 10.16.3
** (UndefinedFunctionError) function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available)
    ElixirLS.LanguageServer.CLI.main()
    (stdlib 3.9.2) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir 1.10.2) lib/code.ex:332: Code.eval_string_with_error_handling/3
[Info  - 10:41:20 AM] Connection to server got closed. Server will restart.

@alfert
Copy link

alfert commented Oct 4, 2020

I have the same effect as @aleury. Starting the language server by hand with /language_server.sh in ~/.vscode/extensions/jakebecker.elixir-ls-0.6.0/elixir-ls-release results in:

 [error] beam/beam_load.c(1883): Error loading module 'Elixir.ElixirLS.LanguageServer.CLI':
  This BEAM file was compiled for a later version of the run-time system than 22.
  To fix this, please recompile this module with an 22 compiler.
  (Use of opcode 169; this emulator supports only up to 168.)

So it seems that my Erlang installation is too old - but officially the language server should run with Erlang 21 as minimum.

@bceskavich
Copy link

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.

@aimerib
Copy link

aimerib commented Oct 4, 2020

  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

Thank you! As a temporary solution, this worked great!

@zemuldo
Copy link

zemuldo commented Oct 4, 2020

@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

@axelson
Copy link
Member

axelson commented Oct 4, 2020

Sorry about this! After investigating it looks like there were two issues, one was that I was hit by microsoft/vscode-vsce#494 which caused the extension to not start because the dependencies were not installed. This issue could be worked around with #145 (comment)

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: 6ef324b

@axelson axelson closed this as completed Oct 4, 2020
@cmuhire
Copy link
Author

cmuhire commented Oct 4, 2020

Thanks a lot for fixing @axelson 🙏

The new version now launches and main features like autocomplete, navigation, docs and PLT build work however I can't seem to get the new Ecto completion feature working (I had successfully tested this earlier but with the local build of the extension in debug mode with the Launch Extension launch configuration).

I also get the following error in the extension log and some docsh warnings that reference the original build directory
elixir_ls_errors

Is anyone else experiencing the same scenario?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests