visual studio code nodejs request 'launch': cannot launch target (reason: spawn node ENOENT)

后端 未结 4 1991
栀梦
栀梦 2021-01-18 18:52

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

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 19:21

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

    Next I noticed that the Node.JS executable is called node on Windows but on Debian (and on Debian-based systems such as Ubuntu) it's called nodejs. So I created an alias - from a root terminal, I ran

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

    and this solved the problem.

提交回复
热议问题