Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js

With a downloaded and installed version of Visual Studio Code 1.2.1, and a 64bit version of node.exe msi placed in my working directory (I am assuming that is correct), how do we add node and npm command line tools to be on our PATH? I am confused in understanding that statement. Where and how do we implement that? I am quoting this requirement directly from the top of this resource page - https://code.visualstudio.com/Docs/runtimes/nodejs

As a result of my current situation, I set a break-point in an app.js file. And when I hit F5, it tells me...

Cannot find runtime 'node' on PATH  

I am completely lost in understanding and fixing this issue in Visual Studio Code.

like image 509
klewis Avatar asked Jun 14 '16 22:06

klewis


People also ask

How do I check if node is installed in VS Code?

To test that you have Node.js installed correctly on your computer, open a new terminal and type node --version and you should see the current Node.js version installed.

Why node is not working in VS Code terminal?

You must click the Kill Terminal button (highlighted) and then restart VS Code and node will start working again. Best on making a change of system environment variable Path is restarting Windows to make sure that really all processes make use of the modified Path variable.


2 Answers

On OSX and VSCode 1.56.2 all I had to do was to close and restart VSCode and the problem went away.

like image 87
David Dehghan Avatar answered Oct 11 '22 17:10

David Dehghan


first run below commands as super user sudo code . --user-data-dir='.' it will open the visual code studio import the folder of your project and set the launch.json as below

{     "version": "0.2.0",     "configurations": [         {             "type": "node",             "request": "launch",             "name": "Launch Program",             "program": "${workspaceFolder}/app/release/web.js",             "outFiles": [                 "${workspaceFolder}/**/*.js"             ],             "runtimeExecutable": "/root/.nvm/versions/node/v8.9.4/bin/node"         }     ] } 

path of runtimeExecutable will be output of "which node" command.

Run the server in debug mode cheers

like image 26
anuj rana Avatar answered Oct 11 '22 16:10

anuj rana