-
Notifications
You must be signed in to change notification settings - Fork 172
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
Failed to activate none environment: Command failed: ruby -rjson -e ... compile error (SyntaxError) #1708
Comments
Thank you for the bug report! I suspect that the extension is not finding the right Ruby version. Since you have no version manager, you'll indeed need to use the custom activation to insert the path to Ruby in the That said, this configuration I have no experience using Windows, but based on this StackOverlow answer it seems that you need to use |
I have this error as well on Windows 11, and adding a custom activation didn't seem to fix it. I was able to fix the bug by opening the extension folder, navigating to out/extension.js, and removing the line break at the end of line 44. EDIT: After a few minutes of running after this patch, the server begins to crash frequently; so this isn't the solution I thought. Just to add more info in case it helps the original issue -- Ruby is in my path in Windows, and the only installed Ruby version is 3.1. I tried adding a custom activation as suggested, but the error was the exact same as if I had just used a "none" manager instead. |
I leave this comment just to express that I have the same error. I use Ruby 3.2.2 installed via RubyInstaller2 on Windows 11 (no extra managers installed), getting the same error:
Did recent update or something like that make this error appear? |
@vinistock, for what it's worth I ran into the same issue as well (Win10/VSCode/RubyInstaller). When I took the command out of the error log and ran it in cmd to check against the baseline ruby install, the command failed with the same "unexpected end-of-input" syntax error @PaulScorthorne reported. Checking the command in notepad++ showed Windows newline characters (\r\n) in the command following I see the command is coming from the ruby.ts test file in this method: Is it possible the line break between Just a thought. |
Just deleted this newline and the error didn't appear anymore |
Folks, thank you so much for debugging and pointing us to the right direction. The changes in Shopify/vscode-ruby-lsp#904 should fix the issue 🙏. |
Just adding onto this that I am facing the same issue, although I'm struggling to find the ruby.ts file. EDIT: Timing! Thanks @vinistock |
Version v0.4.18 should fix this. Please let us know if you find any other issues. |
Operating System
Windows 10
Ruby version
3.2.2
Project has a bundle
Ruby version manager being used
no manager
Description
I have been running Ruby LSP in VS Code for a short while (after the deprecation of the previous Ruby extension), but when I came back to it this morning upon opening my first .rb file I was greeted with:
I've run through all the steps on https://github.com/Shopify/vscode-ruby-lsp#troubleshooting without success.
I also noted #1711, but my Path does not contain any spaces. It is simply
C:\Ruby32-x64\bin
Running
ruby -rjson -e "STDERR.printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump({ env: ENV.to_h, ruby_version: RUBY_VERSION, yjit: defined?(RubyVM::YJIT) }))"
in a terminal returns the JSON block it appears to be after quite happily, including the appropriate"ruby_version":"3.2.2"
The rest of my system knows where Ruby is, what version it is, installs and runs gems, etc. I am fundamentally stumped on what the issue is or where it might have come from.
I have the latest version of the ruby-lsp gem installed, 0.21.3, and the above is the same on the VSCode Release 0.4.17 and Pre-Release 0.5.0 versions.
I also attempted to define a custom activation as suggested in that ticket anyway, following the instructions at https://github.com/Shopify/vscode-ruby-lsp/blob/main/VERSION_MANAGERS.md#custom-activation, but that just led to a different error:
I tried every variation of "C:\Ruby32-x64\bin" I could think of (double slashed, reverse slashed, trailing slashes, relative paths, etc) all to the same result.
Happy to provide any additional info or try other potential troubleshooting steps.
The text was updated successfully, but these errors were encountered: