Родитель
e03b9dfb3e
Коммит
159bf52622
|
@ -77,7 +77,6 @@ Then click on the gear icon to configure a launch.json file, selecting **Chrome*
|
|||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/node_modules/protractor/bin/protractor",
|
||||
"protocol": "inspector",
|
||||
"args": ["${workspaceFolder}/e2e/protractor.conf.js"]
|
||||
}
|
||||
]
|
||||
|
@ -85,13 +84,13 @@ Then click on the gear icon to configure a launch.json file, selecting **Chrome*
|
|||
```
|
||||
|
||||
- Since `ng serve` also compiles the Angular application it can be used as a build task if you prefer the "PROBLEMS" tab to `Ctrl + click` in the terminal (for smaller screens you could open the terminal only when the status bar shows there are problems).
|
||||
|
||||
|
||||
- The following `npm: start` task runs in the background, so we never expect it to fully complete. Instead we define a [problem matcher](https://code.visualstudio.com/docs/editor/tasks#_processing-task-output-with-problem-matchers), which alerts us that the task is ready.
|
||||
|
||||
|
||||
> **Please note**: Running `npm start` instead of `ng serve` ensures the app is served with the version of @angular/cli specified in package.json.
|
||||
|
||||
|
||||
Add the following `npm` task to your `tasks.json` file:
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
|
@ -168,5 +167,3 @@ You can also debug your end-to-end tests running in Protractor with VS Code.
|
|||
2. Set a breakpoint in **app.e2e-spec.ts** on a line in one of the end-to-end tests.
|
||||
|
||||
3. Now go to the Debug view in VS Code, select the **'ng e2e'** configuration, then press F5 or click the green button to run Protractor in a debug session.
|
||||
|
||||
Notice: You might need to update the `"protocol"` property to `legacy` if you are using an older version of Node (older than Node 8)
|
||||
|
|
|
@ -40,7 +40,6 @@ Then click on the gear icon to configure a launch.json file, selecting **Chrome*
|
|||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Electron: Main",
|
||||
"protocol": "inspector",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
"runtimeArgs": [
|
||||
"--remote-debugging-port=9223",
|
||||
|
|
|
@ -26,7 +26,6 @@ This guide shows how to use the built-in Node debugger to debug Gatsby **build p
|
|||
"name": "Gatsby develop",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"protocol": "inspector",
|
||||
"program": "${workspaceRoot}/node_modules/gatsby/dist/bin/gatsby",
|
||||
"args": ["develop"],
|
||||
"stopOnEntry": false,
|
||||
|
@ -37,7 +36,6 @@ This guide shows how to use the built-in Node debugger to debug Gatsby **build p
|
|||
"name": "Gatsby build",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"protocol": "inspector",
|
||||
"program": "${workspaceRoot}/node_modules/gatsby/dist/bin/gatsby",
|
||||
"args": ["build"],
|
||||
"stopOnEntry": false,
|
||||
|
|
|
@ -39,7 +39,6 @@ VS Code automatically detects a MERN based project and creates this launch confi
|
|||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"protocol": "inspector",
|
||||
"runtimeExecutable": "nodemon",
|
||||
"runtimeArgs": [
|
||||
"--inspect=9222"
|
||||
|
@ -64,6 +63,4 @@ With this setup it is possible to edit the source while the server is running: s
|
|||
|
||||
The launch config uses the integrated terminal because `nodemon` is an interactive tool that reads from stdin which is not supported in the default debug console.
|
||||
|
||||
> **Please note**: there is an unfortunate redundancy (and potential inconsistency) between the `protocol`, `runtimeArgs`, and `port` attributes. If the value of `protocol` is changed to `legacy`, the values for `runtimeArgs` and `port` must be changed as well, otherwise a problematic inconsistency will occur. This redundancy can be eliminated after we have implemented this [feature](https://github.com/Microsoft/vscode/issues/26315) for the 'legacy' and the 'inspector' protocol.
|
||||
|
||||
> **Please note**: Currently this recipe requires that "nodemon" is installed globally (despite the fact that it would be available in `node_modules/.bin`). This requirement will be lifted after we have implemented this [feature]( https://github.com/Microsoft/vscode/issues/28100).
|
||||
|
|
|
@ -13,7 +13,7 @@ We recommend that you use our Node debugger in an `attach` configuration that's
|
|||
1. Make sure to have the latest version of VS Code installed.
|
||||
|
||||
2. This guide assumes that you are using the official sample app [nodejs-shopping-cart](https://github.com/gtsopour/nodejs-shopping-cart). Clone the repo to get started
|
||||
>
|
||||
>
|
||||
```
|
||||
git clone git@github.com:gtsopour/nodejs-shopping-cart.git
|
||||
cd nodejs-shopping-cart
|
||||
|
@ -32,7 +32,7 @@ Update your `package.json` section to:
|
|||
"start": "node ./bin/www",
|
||||
"debug": "nodemon --inspect ./bin/www"
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
## Configure VS Code debugging with a launch.json file
|
||||
|
||||
|
@ -53,13 +53,12 @@ Then click on the gear icon to configure a launch.json file, selecting **Node**
|
|||
"name": "Node: Nodemon",
|
||||
"processId": "${command:PickProcess}",
|
||||
"restart": true,
|
||||
"protocol": "inspector",
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Notice the `restart` property. This setting is key as it tells our debugger to re-attach to the Node process, if the process get's terminated. Read more about the setting [here in our docs](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_restarting-debug-sessions-automatically-when-source-is-edited).
|
||||
Notice the `restart` property. This setting is key as it tells our debugger to re-attach to the Node process, if the process get's terminated. Read more about the setting [here in our docs](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_restarting-debug-sessions-automatically-when-source-is-edited).
|
||||
|
||||
## Start your node app via your new NPM script
|
||||
|
||||
|
@ -68,7 +67,7 @@ The next step is to start your Node app via your new `npm run debug` script. We
|
|||
![terminal](terminal.png)
|
||||
|
||||
## Debugging the Node process
|
||||
|
||||
|
||||
1. Go to the Debug view, select the **'Node: Nodemon'** configuration, then press F5 or click the green play button.
|
||||
|
||||
2. VS Code should now list all of your running node processes.
|
||||
|
@ -76,7 +75,7 @@ The next step is to start your Node app via your new `npm run debug` script. We
|
|||
![processes](processes.png)
|
||||
|
||||
3. Select the node process that's started with the `--inspect` flag.
|
||||
|
||||
|
||||
3. Go ahead and set a breakpoint in **routes/index.js** on `line 10` within the `route handler` function.
|
||||
|
||||
![breakpoint-main](breakpoint.png)
|
||||
|
@ -85,8 +84,8 @@ The next step is to start your Node app via your new `npm run debug` script. We
|
|||
|
||||
5. Your breakpoint should now be hit.
|
||||
|
||||
6. Try to make a change to **routes/index.js**.
|
||||
|
||||
6. Try to make a change to **routes/index.js**.
|
||||
|
||||
7. Nodemon should kick in after the change, and you should see VS Code re-attach to the newly spawned Node process automatically.
|
||||
|
||||
8. Party 🎉🔥
|
||||
|
|
Загрузка…
Ссылка в новой задаче