Created
September 18, 2017 09:30
-
-
Save jeffhuangtw/e64fa7eabf6e16e01842e76ff53ba233 to your computer and use it in GitHub Desktop.
[Visual Studio Code] [nodejs] [debugger] [foreman] vsc + foreman + debugger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. add a executable dev.sh to run your script (example: web.js) | |
#!/bin/bash | |
node --inspect web.js | |
// 2. install foreman | |
$ npm install -g foreman | |
// 3. prepare your environment variables file | |
$ touch .env | |
// 4. run your node script | |
nf run ./dev.sh | |
// 5. edit your VSC debugger config | |
// .vscode/launch.json | |
{ | |
// Use IntelliSense to learn about possible Node.js debug attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "attach", | |
"protocol": "inspector", | |
"restart": false, | |
"localRoot": "${workspaceRoot}", | |
"remoteRoot": null, | |
"name": "Attach to Process", | |
"port": 9229 | |
} | |
] | |
} | |
// 6. debug with your VSC IDE | |
add some debug points and click the debugger icon at VSC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment