我尝试在Cloud Foundry中调试应用程序 我将在类型脚本中编写的应用程序推送到CF并打开ssh
{
"name": "myApp",
"version": "1.0.0",
"description": "my App",
"main": "index.js",
"scripts": {
"build": "tsc",
"dev": "tsc --watch & nodemon dist",
"test": "mocha --require ts-node/register test/**/*.ts",
"lint": "tslint",
"start": "node --inspect dist/src/index.js"
},
"engines": {
"node": ">=7"
},
"author": "",
"license": "ISC"
}
ssh
cf ssh -N -T -L 9229:127.0.0.1:9229 myApp
{
"description": "node.js instance",
"devtoolsFrontendUrl": "chrome-devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=127.0.0.1:9229/552ad891-d8a7-405f-ba24-df7718d9d4d6",
"devtoolsFrontendUrlCompat": "chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/552ad891-d8a7-405f-ba24-df7718d9d4d6",
"faviconUrl": "https://nodejs.org/static/favicon.ico",
"id": "552ad891-d8a7-405f-ba24-df7718d9d4d6",
"title": "dist/src/index.js",
"type": "node",
"url": "file:///home/vcap/app/dist/src/index.js",
"webSocketDebuggerUrl": "ws://127.0.0.1:9229/552ad891-d8a7-405f-ba24-df7718d9d4d6"
} ]
我在VS代码中打断了
我从VS代码运行附件
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"protocol": "inspector",
"address": "localhost",
"port": 9229,
"restart": true,
"preLaunchTask": "npm: build",
"sourceMaps": true,
"outFiles" : [ "${workspaceRoot}/dist/**/*.js" ]
},
当我设置断点时,我得到了未验证的断点 我也从CF应用程序获得了
2019-01-22T21:18:51.21+0200 [APP/PROC/WEB/0] ERR Debugger listening on ws://0.0.0.0:9229/552ad891-d8a7-405f-ba24-df7718d9d4d6
2019-01-22T21:18:51.21+0200 [APP/PROC/WEB/0] ERR For help, see: https://nodejs.org/en/docs/inspector