Reputation: 433
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:
Upvotes: 1
Views: 844
Reputation: 2624
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
Upvotes: 0
Reputation: 433
What worked for me:
Using nodemon
Added a run/debug NPM configuration that runs this script "dev": "nodemon"
Upvotes: 0
Reputation: 93728
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:
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"
]
]
}
Upvotes: 4