Could not connect to the debugger when using the default port (0)
See original GitHub issueExpected Behavior
Recently, I upgraded our project from Angular 8.x to 9.x, Nest 6.x to 7.x and Nx 8.x to 9.x. Since then the debugger could not connect to the process.
Current Behavior
After the upgrade and migration, only passWithNoTests
been added to the angular.json
and there were no changes to nx.json
and any of the tsconfigs
.
It is not working even without the changes to the files and only using the upgraded dependencies.
I am running the project from the terminal using ng serve
and I tried reopening VScode
, removing/reinstalling node_modules
and also debugging using the Chrome’s dedicated Node DevTools for Node.js
.
When adding port
to the options in angular.json
it works without any problem.
So it is probably related to #2510.
Steps to Reproduce
You can find my repro here. In master
branch you can find the files before the upgrade, and in nx9
branch the upgraded version.
Or just run the following steps:
-
Create a new workspace using the latest v8:
npx create-nx-workspace@8.12.9 repro-nx-nest-debug
-
Upgrade nx:
yarn update
-
Add a breakpoint and run the api:
yarn start api
-
Try to attach to the process using the options
Debug: Attach to Node process
from theCommand Palette...
.
Context
- I’m using VSCode 1.43.1 and Node.js 12.8.1
nx report
@nrwl/angular : 9.1.2
@nrwl/cli : 9.1.2
@nrwl/cypress : 9.1.2
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.1.2
@nrwl/linter : 9.1.2
@nrwl/nest : 9.1.2
@nrwl/next : Not Found
@nrwl/node : 9.1.2
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.1.2
@nrwl/web : Not Found
@nrwl/workspace : 9.1.2
typescript : 3.7.5
Relevant packages
@angular-devkit/build-angular@0.900.6
@angular/cli@9.0.6
@angular/common@9.0.7
@angular/compiler@9.0.7
@angular/compiler-cli@9.0.7
@angular/core@9.0.7
@nestjs/common@7.0.3
@nestjs/core@7.0.3
@nestjs/jwt@7.0.0
@nestjs/passport@7.0.0
@nestjs/platform-express@7.0.3
@nestjs/platform-socket.io@7.0.3
@nestjs/schematics@7.0.0
@nestjs/serve-static@2.1.0
@nestjs/swagger@4.4.0
@nestjs/testing@7.0.3
@nestjs/typeorm@7.0.0
@nestjs/websockets@7.0.3
core-js@3.6.4
ts-node@8.6.2
tslib@1.11.1
Relevant project configuration in angular.json
"server": {
"root": "apps/server",
"sourceRoot": "apps/server/src",
"projectType": "application",
"prefix": "server",
"schematics": {},
"architect": {
"build": {
"builder": "@nrwl/node:build",
"options": {
"outputPath": "dist/apps/server",
"main": "apps/server/src/main.ts",
"tsConfig": "apps/server/tsconfig.app.json",
"assets": ["apps/server/src/assets"]
},
"configurations": {
"production": {
"optimization": true,
"extractLicenses": true,
"inspect": false,
"fileReplacements": [
{
"replace": "apps/server/src/environments/environment.ts",
"with": "apps/server/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@nrwl/node:execute",
"options": {
"buildTarget": "server:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/server/tsconfig.app.json",
"apps/server/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!apps/server/**"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/server/jest.config.js",
"maxWorkers": 3,
"tsConfig": "apps/server/tsconfig.spec.json",
"passWithNoTests": true
}
}
}
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
For anyone having the same issue, fast solution add port to angular.json in section see attached
@Cammisuli Do you have an example (
launch.json
) config that works with the new VSCode debugger and"port": 0
?