I am unable to debug in WebStorm npm configuration

Issue

I am running a Node app with an npm configuration in WebStorm but I cannot debug, I keep getting the error below.

I have a clean system with node 16.5.0 installed along with npm

The app runs or when you just run it.

"c:\Program Files\nodejs\npm.cmd" run start
Debugger listening on ws://127.0.0.1:63505/499bdffd-e2d2-40af-9e44-0fc1b93a7404
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
^C^CTerminate batch job (Y/N)? 
Process finished with exit code 1

Here is my package.json

{
  "name": "storefront_backend",
  "version": "0.1.0",
  "description": "",
  "main": "server.ts",
  "scripts": {
    "build": "tsc --build",
    "start": "ts-node src/server.ts",
    "watch": "tsc-watch --esModuleInterop src/server.ts --outDir ./dist --onSuccess \"node ./dist/server.js\"",
    "test": "tsc -p . & mocha ./src/spec/*.js",
    "tsc": "tsc"
  },
  "author": "Udacity",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "db-migrate": "^0.11.13",
    "db-migrate-pg": "^1.2.2",
    "dotenv": "^16.0.1",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "pg": "^8.5.1",
    "typescript": "^4.1.3"
  },
  "devDependencies": {
    "@types/chai": "^4.3.1",
    "@types/express": "^4.17.9",
    "@types/jasmine": "^3.10.6",
    "@types/mocha": "^9.1.1",
    "@types/node": "^17.0.35",
    "@types/pg": "^7.14.7",
    "bcrypt": "^5.0.1",
    "chai": "^4.3.6",
    "chai-http": "^4.3.0",
    "eslint": "^8.16.0",
    "jasmine": "^3.6.4",
    "jasmine-spec-reporter": "^6.0.0",
    "jasmine-ts": "^0.3.0",
    "jest": "^28.1.0",
    "mocha": "^10.0.0",
    "request": "^2.88.2",
    "supertest": "^6.2.3",
    "ts-node": "^9.1.1",
    "tsc-watch": "^4.2.9"
  }
}

Solution

Must be WEB-55884 that is fixed in 2022.1.2. Workaround: open Settings | Languages & Frameworks | Node.js and set Package manager to npm package folder, e.g. C:\Program Files\nodejs\node_modules\npm.

Answered By – lena

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.