sublimelsp / LSP-Grammarly

Grammarly support for Sublime's LSP plugin, using the Grammarly language server
MIT License
25 stars 1 forks source link

Older version of Node.js is required #23

Open wout opened 1 year ago

wout commented 1 year ago

An old version of Node.js (16) is required, which is reaching end-fo-life in September this year.

image

rchl commented 1 year ago

It's an issue with the underlying server (https://github.com/znck/grammarly) that it doesn't work with Node 18+. Feel free to report an issue there, if there isn't one already.

EDIT: There is one already: https://github.com/znck/grammarly/issues/334

larseggert commented 1 year ago

Is there a way to tell the plugin which node installation to use? (I have node@16 installed via Homebrew, but can't figure out how to tell the plugin to use that instead of the system default.)

rchl commented 1 year ago

I think you could override command in LSP-Grammarly settings to:

"command": ["...path_to_node...", "${server_path}", "--stdio"]

Alternatively use the bundled Node version by setting "nodejs_runtime": ["local"] in Preferences: LSP Utils Settings.

larseggert commented 1 year ago

I tried to add "nodejs_runtime": ["local"] to LSP.sublime-settings, but that didn't help.

rchl commented 1 year ago

Add in Preferences: LSP Utils Settings (open from command palette).

rchl commented 1 year ago

I believe this means the end of this server soon: https://github.com/znck/grammarly/issues/384#issuecomment-1770297076

luispuerto commented 10 months ago

I just updated to Sonoma, and this stopped working on my sublime. It is not incredibly important to me, but if I can make it work, life will be slightly easier. Is there any way to make the LSP-Grammarly aware that there is already a node.js operating in the system? In my case, it is not a PATH thing since the sublime has a correct path in its environment.

I can't find the Preferences: LSP Utils Settings on the command palette.

predragnikolic commented 10 months ago

Hello @luispuerto, Grammarly doesn't support node 18.

Rafal mention the fix in this comment.

If you have nvm you can set the node version to 16, and copy the path:

λ  ~  nvm use 16
Your user’s .npmrc file (${HOME}/.npmrc)
has a `globalconfig` and/or a `prefix` setting, which are incompatible with nvm.
Run `nvm use --delete-prefix v16.16.0` to unset it.
λ  ~  node -v
v16.16.0
λ  ~  which node 
/home/predragnikolic/.nvm/versions/node/v16.16.0/bin/node

Than copy the last line, And in the command palette select Preference: LSP-grammarly settings, and edit the "command" setting:

{
    "command": [
        "/home/predragnikolic/.nvm/versions/node/v16.16.0/bin/node",
        "${server_path}",
        "--stdio"
    ]
}
luispuerto commented 10 months ago

I'm wondering if I can do something similar with Homebrew

image

And installing Node16 and pointing grammarly to that version.

luispuerto commented 10 months ago

I tried with hombrew and it fails:

{
  "command": [
    "/opt/homebrew/opt/node@16/bin/node",
    "${server_path}",
    "--stdio"
  ]
}
Screenshot 2024-01-07 at 11 05 50
Unable to start subprocess for grammarly
Traceback (most recent call last):
  File "/Users/luispuerto/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/core/windows.py", line 250, in start_async
    if plugin_class.needs_update_or_installation():
  File "/Users/luispuerto/Library/Application Support/Sublime Text/Lib/python33/lsp_utils/_client_handler/abstract_plugin.py", line 101, in needs_update_or_installation
    server = cls.get_server()
  File "/Users/luispuerto/Library/Application Support/Sublime Text/Lib/python33/lsp_utils/npm_client_handler.py", line 130, in get_server
    'skip_npm_install': cls.skip_npm_install,
  File "/Users/luispuerto/Library/Application Support/Sublime Text/Lib/python33/lsp_utils/server_npm_resource.py", line 49, in create
    raise Exception('Failed resolving Node.js Runtime. Please see Sublime Text console for more information.')
Exception: Failed resolving Node.js Runtime. Please see Sublime Text console for more information.

PS1/ I'm on macOS… so I really know what is going on with File "/Users/luispuerto/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/core/windows.py", line 250, in start_async. PS2/ Node16 is correctly installed

image
dsmaynard commented 10 months ago

This fix doesn't work for me either (Arch Linux), even after specifying v16.0 in the LSP settings.

luispuerto commented 10 months ago

At least on my case the message is different form the OP's one. So perhaps I need to fix first the fact that seems that sublime is not able to reach any node.

salleuska commented 9 months ago

Hi, I had a similar problem and I was just able to make LSP-Grammarly start in Sublime by

  1. Uninstalling the latest version of Node.js from my Mac (which was 20something). [Not sure if this actually helped.]
  2. Following the advice here https://github.com/sublimelsp/LSP-Grammarly/issues/4#issuecomment-1145886614

If you delete this folder: /[REDACTED]Library/Caches/Sublime Text/Package Storage/LSP-Grammarly/18.3.0/ and sublime can't find nodejs, it will automatically download 16.15.0.

In my case I had LSP-Grammarly/16.15.0 which should have been the right version, so not sure why re-installing that made LSP-Grammarly restart. Hope it can help.

luispuerto commented 9 months ago

I don't have ~/Library/Caches/Sublime Text/Package Storage/LSP-Grammarly/ so I guess it has nothing to do with it, not to mention that other stuff depends on node current version.

The thing for me is make the package understand that there is another version of node and where is located.

PS/ In my case, it was working perfectly till I updated to Sonoma, and I haven't changed anything… so something is acting up.

dsmaynard commented 9 months ago

I don't have ~/Library/Caches/Sublime Text/Package Storage/LSP-Grammarly/ so I guess it has nothing to do with it, not to mention that other stuff depends on node current version.

The thing for me is make the package understand that there is another version of node and where is located.

PS/ In my case, it was working perfectly till I updated to Sonoma, and I haven't changed anything… so something is acting up.

On my linux the corresponding location is .cache/sublime-text/Package\ Storage/LSP-Grammarly/, but deleting the folders still didn't help, so that's not a fix.

luispuerto commented 9 months ago

By the way… if my memory doesn't fail, I remember downloading the node for this package the first time I installed it… I mean is asked me if I wanted to download node. Where is that installation located? because perhaps something happened after the update.

Perhaps deleting everything solve the issue.

salleuska commented 9 months ago

I don't have ~/Library/Caches/Sublime Text/Package Storage/LSP-Grammarly/ so I guess it has nothing to do with it, not to mention that other stuff depends on node current version.

The thing for me is make the package understand that there is another version of node and where is located.

PS/ In my case, it was working perfectly till I updated to Sonoma, and I haven't changed anything… so something is acting up.

Got it. I realized that I still have a version of node (16.20.2) installed, so maybe uninstalling the latest one did not help (I'll update the answer). I was considering removing all versions of node and reinstalling the ones I needed. However, having sublime automatically install node 16.15.0 made LSP-Grammarly restart for me.

Anyway, I had this problem before updating to Sonoma (which I did two days ago), so there is still the chance that the same issue may have different causes.

luispuerto commented 9 months ago

Anyhow, @salleuska, today isn't the last day this will work correctly. (now that I reread the thread carefully)

I believe this means the end of this server soon: znck/grammarly#384 (comment)

I think that after today the package will no longer work properly for anyone.

Correct?

If you can confirm it tomorrow, that would be great, especially if you have Grammarly Pro.

salleuska commented 9 months ago

I have missed that. Indeed, today I opened Sublime and although LSP-Grammarly is still present I am now logged off from Grammarly and not able to log in again.

Anyway, I am still getting the suggestions from the free version.

luispuerto commented 9 months ago

So, there is no point in continuing to try to make this work. I already deleted the package.

rchl commented 9 months ago

Unless the original server at https://github.com/znck/grammarly starts being maintained properly again, I don't really see point in working on this either.

predragnikolic commented 4 months ago

znck/grammarly repository has been archived by the owner on May 7, 2024