天天看點

vscode 遠端調試nodejs

{
  // 使用 IntelliSense 了解相關屬性。 
  // 懸停以檢視現有屬性的描述。
  // 欲了解更多資訊,請通路: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "遠端調試",
      "address": "172.16.2.203",
      "port": 9229,
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "C:\\Users\\Administrator\\Desktop\\test-space"
    }
  ]
}      
  • 遠端js
const http = require('http')

const app = http.createServer((req, res) => {
    debugger
    const a = 18
    const b = 12
    const c = a * b

    res.end('okok' + c)
})

app.listen(9090, () => console.log(`Server is running at 9090 ...`))