Visual studio code nodejs start request: cannot start target (reason: spawn node ENOENT)

When I use visual studio code to debug a nodejs application. studio visual code tell me request 'launch': cannot launch target (reason: spawn node ENOENT)

enter image description here

My version of nodejs is 4.2.4

+5
source share
4 answers

We managed to avoid this when working on Windows by specifying npm.cmd instead of npm in the VS code debugging configuration, for example,

 "runtimeExecutable": "npm.cmd", 
+3
source

Some discussions are posted here.

How to debug "Error: spawn ENOENT" on node.js?

In particular, the following points should be checked:

  • Make sure the PATH environment variable is set
  • PATHEXT an environment variable that can cause certain calls to prevent caviar from working on Windows.
+2
source

I was getting this error on a Debian Linux system. I noticed that the same thing worked fine on Windows.

I further noted that the Node.JS executable is called node on Windows, but on Debian (and on Debian based systems like Ubuntu) it is called nodejs. So I created an alias - from the root terminal, I ran

ln -s / usr / bin / nodejs / usr / local / bin / node

and this solved the problem.

+2
source

This usually happens if you already had your visual code editor when installing node js on Windows. I would advise you to close your Visual Studio code and restart it. This problem should disappear.

If you do not restart the computer and check whether debugging works flawlessly

+1
source

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


All Articles