1

I am trying to debug a nodejs ES6 server, even though I am using babel, I am getting this warning:

(node:17736) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. 
Please use `node --inspect` or `node --inspect-brk` instead.

Process finished with exit code 9

Can someone help me fix this? I saw many questions about this, but they all seem old and are not working for newest versions of nodejs.

This is my configuration:

3
  • 1
    What is unclear about the warning? Are you facing any other issues? Commented Nov 11, 2019 at 22:09
  • I don't know how to fix it. How do I set it up correctly to be able to debug.. Commented Nov 11, 2019 at 22:10
  • Issue similar to this github.com/Microsoft/vscode/issues/44834 Commented Nov 12, 2019 at 10:44

3 Answers 3

4

Seems the Node.js version babel-node is using doesn't accept --debug-brk option, and Webstorm can't detect what Node.js version is being used (normally it checks the version of Node.js chosen as Node interpreter: and uses the appropriate options when running).

Please select the Node.js executable instead of babel-node there and use --require @babel/register as Node parameters: in run configuration to get ES6 code compiled on-the-fly:

enter image description here

Of course, you need to make sure to install the corresponding modules and set up the .babelrc accordingly

package.json:

"dependencies": {
  "@babel/cli": "^7.2.3",
  "@babel/core": "^7.4.0",
  "@babel/preset-env": "^7.4.2",
  "@babel/register": "^7.4.0",
...
}

.babelrc:

{
  "presets": [
    [
      "@babel/preset-env"
    ]
  ]
}
Sign up to request clarification or add additional context in comments.

Comments

0

What worked for me:

Using nodemon Added a run/debug NPM configuration that runs this script "dev": "nodemon"

Comments

0

Since Lena's answer won't work with async code, you will need to install @babel/polyfill and require it in the webstorm debug configuration together with the babel-register

--require @babel/register --require @babel/polyfill

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.