microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 237 forks source link

TypeScript Sublime Plugin does not seem to work on Pop! OS #766

Closed Fulguritude closed 2 years ago

Fulguritude commented 3 years ago

There is no underlinign of errors, autocompletion, etc, on Pop! OS (an Ubuntu-based distro).

Here is the relevant output from my Sublime Text 3 console:

reloading plugin TypeScript.main
2020-12-22 16:29:17,637: 140576439605056: WARNING: TypeScript plugin initialized.
plugins loaded
Your path for TeXPrevew: /app/utils/bin:/app/sublime_merge/bin:/app/bin:/usr/bin:/usr/local/bin
[ECC:INFO   ]: Getting version from command: `clang++ -v`
Path of node executable is configured as: /usr/bin/node
Configured node path is not a valid executable.
Unable to find executable file for node on path list: /app/utils/bin:/app/sublime_merge/bin:/app/bin:/usr/bin:/usr/local/bin:/usr/local/bin:$NVM_BIN
To specify the node executable file name, use the 'node_path' setting
2020-12-22 16:29:17,728: 140576439605056: ERROR: can not send request; node process not running
2020-12-22 16:29:17,728: 140576439605056: ERROR: can not send request; node process not running
2020-12-22 16:29:17,728: 140576439605056: ERROR: can not send request; node process not running
2020-12-22 16:29:17,930: 140576439605056: ERROR: can not send request; node process not running
2020-12-22 16:29:17,933: 140576439605056: ERROR: can not send request; node process not running

Notice:

Path of node executable is configured as: /usr/bin/node
Configured node path is not a valid executable.

I set my node_path in my settings, and the node_path seems to be recognized (this is indeed where node is on my machine); but for some reason ST3 cannot execute node or recognize it...

Fulguritude commented 3 years ago

I'd really like to fix this. Where in the TypeScript-Sublime-Plugin repo can I find the source code where the node executable read ? I'm thinking it might be looking for a node.exe or something, rather than plain node, and I want to see if I can fix it and make a pull request.

Fulguritude commented 3 years ago

So I have some progress, running grep -rnw '.' -e 'Configured node path', I found that the only file in the repo with that specific string was ./typescript/libs/node_client.py. This string is returned when os.path.isfile(fpath) and os.access(fpath, os.X_OK) returns false. Now, I have no idea why this returns false. I tried the exact same logic (with the appropriate filepath) via my terminal's python3 interpreter, and it returned true...

I tried removing the is_executable check as well (and just force node_path = configured_node_path); but it didn't work either. I'm know I'm on the right file, because I added some print statements and these were read.

Permissions on this instance of node are 755, with root as the owner. Could this error be due to the version of Python (or its permissions) that the plugin uses to run the node_client.py config ? I'll try experimenting some more.

Fulguritude commented 3 years ago

Just tried print("PWD: " + os.getcwd()) from node_client.py, it returned PWD: /app/extra/sublime_text. None of these directories (app, extra, sublime_text) exist, so I suppose Sublime Text is using some sort of chroot-jail-like virtual environment to run. Not surprising then that it can't find node on its path, given that it has a whole different root... Does anyone know where this virtual env is supposed to be created so I can try to put a symlink to node inside it ? Or have a better way of adding node to this virtual environment ? I tried adding the Nodejs sublime package to no avail

Fulguritude commented 3 years ago

After further research, this seems to in fact be an issue with Sublime Text itself. I have posted the following message on their forums: https://forum.sublimetext.com/t/bug-sublime-text-cant-find-nodejs-on-pop-os-ubuntu-20-04/55553