LSP-Grammarly icon indicating copy to clipboard operation
LSP-Grammarly copied to clipboard

Older version of Node.js is required

Open wout opened this issue 2 years ago • 22 comments

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

image

wout avatar Jun 15 '23 05:06 wout

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

rchl avatar Jun 19 '23 20:06 rchl

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

larseggert avatar Aug 16 '23 12:08 larseggert

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.

rchl avatar Aug 16 '23 12:08 rchl

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

larseggert avatar Aug 16 '23 13:08 larseggert

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

rchl avatar Aug 16 '23 15:08 rchl

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

rchl avatar Oct 19 '23 18:10 rchl

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.

luispuerto avatar Dec 22 '23 08:12 luispuerto

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"
	]
}

predragnikolic avatar Jan 04 '24 19:01 predragnikolic

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

image

And installing Node16 and pointing grammarly to that version.

luispuerto avatar Jan 07 '24 09:01 luispuerto

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

luispuerto avatar Jan 07 '24 10:01 luispuerto

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

dsmaynard avatar Jan 07 '24 13:01 dsmaynard

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.

luispuerto avatar Jan 07 '24 13:01 luispuerto

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.

salleuska avatar Jan 10 '24 14:01 salleuska

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.

luispuerto avatar Jan 10 '24 14:01 luispuerto

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.

dsmaynard avatar Jan 10 '24 15:01 dsmaynard

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.

luispuerto avatar Jan 10 '24 15:01 luispuerto

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.

salleuska avatar Jan 10 '24 15:01 salleuska

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.

luispuerto avatar Jan 10 '24 15:01 luispuerto

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.

salleuska avatar Jan 11 '24 14:01 salleuska

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

luispuerto avatar Jan 11 '24 14:01 luispuerto

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.

rchl avatar Jan 11 '24 14:01 rchl

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

predragnikolic avatar Jun 21 '24 10:06 predragnikolic