I want to debug my Node.Js code in visual studio code. when I add break point and starts debugging it gives me error "Cannot find runtime 'node' on PATH". I am runnimg VS Code in ubuntu 18.04. Can some help me in fixing this issue? Any help in this regard will be highly appreciated.
After alot of searching I resolved this issue myself by following these two steps:
- I opened the Integrated terminal and type command
which node. In my case it responded with
- Then I added an attribute "runtimeExecutable" in launch.json file and to its value I passed the path received by entering command mentioned in step one. like this
After following these two steps, I added break point and started debugging. It started debugging.
I had a similar issue with zsh and nvm on ubuntu 18.10, I fixed it by adding nvm initialization script in
~/.profile and restart login session like this
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
I have the same problem, but I have installed 2 VSC versions, one from deb package (that works without the problems) and one from Snap store that have this problem. I'm using nvm for node. Problem is that snap VSC version is running as a root and don't have node in path (even if it works in development console). I fixed this by symbolic link of node executable for root:
sudo ln -s "$NVM_DIR/versions/node/v10.16.0/bin/node" "/usr/local/bin/node"
where v10.16.0 is my current node version.