Cannot find runtime 'node' in PATH - Visual Studio and Node.js code

With the downloaded and installed version of Visual Studio Code 1.2.1 and the 64-bit version of node.exe msi located in my working directory (I assume this is correct), how do we add the node and npm command line tools to enable our PATH? I am confused in understanding this statement. Where and how do we implement this? I quote 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 breakpoint in the app.js. And when I press F5, he tells me ...

Cannot find runtime 'node' on PATH 

I completely lost understanding and fixing this problem in Visual Studio code.

+18
source share
10 answers

To follow, I just ran into this. When I installed Node.js, the option "Add to PATH" ("Available after restart") appeared. Windows seems to just need to reboot in order to make everything work.

+27
source

So node went out of the way. You can do

  SET PATH=C:\Program Files\Nodejs;%PATH% 

Or just reinstall node to fix it. which you think is easiest for you

+9
source

first run the commands below as sudo code. --user-data-dir='.' sudo code. --user-data-dir='.' super user sudo code. --user-data-dir='.' sudo code. --user-data-dir='.' sudo code. --user-data-dir='.' the visual code studio opens, import your project folder and install the launch.json file as shown 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" } ] } 

the path to runtimeExecutable will be displayed with the "Which "which node" command.

Start the server in debug mode

+9
source

A quick fix that works for me. Change to the root directory of your folder from the command line (cmd). then when you are in the root directory, type:

 code . 

Then press enter. Pay attention to the ".", Do not forget about it. Now try debugging and see if you get the same error.

+4
source

I also ran into this error. Restart your computer for me.

+3
source

Do not run VS code from the Start menu separately. using

$ Code.

Command to run VS code. Now create a file with the extension .js and start debugging (F5). It will be done.

Otherwise, reboot the system and perform the same process.

+1
source

On OSX and VSCode 1.30.0, all I had to do was close and restart VSCode, and the problem disappeared.

+1
source

There was the same problem, and in my case it was a problem with the extension of the code against. Try running the code like:

 $ code --disable-extensions 

Once in the editor, I ran my program in debug mode and worked, and then started the code with

 $ code 

And it continued to work fine.

Hope this works for you.

+1
source

I had a similar problem with zsh and nvm on Linux, I fixed it by adding the nvm initialization script to ~/.profile and restarting the login session as follows

 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" 
+1
source

I did which node on my terminal: /usr/local/bin/node

and then I added "runtimeExecutable": "/usr/local/bin/node" to my json file.

0
source

Source: https://habr.com/ru/post/989818/


All Articles