vscode-javascript-repl-docs icon indicating copy to clipboard operation
vscode-javascript-repl-docs copied to clipboard

How to set Node.js path manually, the extension can't seem to find node.js in the $PATH but it exists

Open shahidcodes opened this issue 4 years ago • 8 comments

Hi,

JS Repl can't seem to find Node in the path. I confirmed it exists. Is there any way to set node binary path manually?

shahidcodes avatar Jan 29 '22 01:01 shahidcodes

Got the same issue...

mika76 avatar Feb 17 '22 09:02 mika76

I have this issue with node installed via asdf, which puts the node shim in ~/.asdf/shims. This is on the path available to VSCode (can be seen in the VSCode terminal).

crispinb avatar Apr 04 '22 23:04 crispinb

Probably should have mentioned before (thanks @crispinb for reminding me) my node is installed via 'nvm'...

➜  ~ nvm --version
0.38.0
➜  ~ node --version
v17.2.0

mika76 avatar Apr 05 '22 08:04 mika76

Maybe I am interested to support a setting where users could set the Node.js path manually but I am still wondering why the extension seems not to find the node executable for some users. I have tested the extension with the following settings

➜  ~ nvm --version
0.39.0
➜  ~ node --version
v17.2.0

and it seems to work fine. The operating system that I am testing now is macOS Monterey 12.2.1

axilleasiv avatar Apr 10 '22 17:04 axilleasiv

I'm puzzled to have to report that with no relevant changes from me (at least that I'm aware of), this seems to have fixed itself. This is on linux, with node installed via asdf (which runs node from a small bash shim script on the login shell path).

The only thing that strikes me is that when I reported the problem it was first time I had used javascript repl since using this particular recent linux install. But I don't know what might have been different between first and second runs. I'll report back if anything changes.

crispinb avatar Apr 10 '22 22:04 crispinb

For me the solution was to quit VSCode and then re-open it. Hope that helps anyone else too.

Evertt avatar Sep 21 '22 02:09 Evertt

I encountered the same issue, it's probably related to using nvm. I managed to solve it this way: sudo ln -s /home/<username>/.nvm/versions/node/v18.14.0/bin/node /usr/bin/node and then reloading the window.

It's a very useful extension by the way, a huge thanks to the developer for creating this!

qadzek avatar Feb 13 '23 13:02 qadzek

Based on @infinitewhileloop answer, looks like extension instead of PATH search node here /usr/bin/node. With this knowledge we can use next command for fix it for any node version manager:

sudo ln -s $(which node) /usr/bin/node

This helps me even without restarting vscode

Akiyamka avatar Mar 10 '23 15:03 Akiyamka