How to set Node.js path manually, the extension can't seem to find node.js in the $PATH but it exists
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?
Got the same issue...
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).
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
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
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.
For me the solution was to quit VSCode and then re-open it. Hope that helps anyone else too.
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!
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