1

My configuration in WebStorm looks like this:

config

and it fails with

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node server.js`
[nodemon] unable to run executable: "babel-node"
[nodemon] Error
    at Bus.utils.bus.on (/Users/SOME_PATH_TO_PROJECT/node_modules/nodemon/lib/nodemon.js:156:25)
    at Bus.emit (events.js:202:15)
    at ChildProcess.<anonymous> (/Users/SOME_PATH_TO_PROJECT/node_modules/nodemon/lib/monitor/run.js:143:9)
    at ChildProcess.emit (events.js:197:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:252:12)
    at onErrorNT (internal/child_process.js:427:16)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)

The latest @babel/node is installed with yarn both globally and locally (node_modules):

$ which babel-node
/usr/local/bin/babel-node

Also tried give absolute babel-node path and relative local path (targeting node_modules). No luck.

Any idea why WebStorm cannot execute the installed babel-node? Needless to say, it works in the terminal.

4

1 回答 1

0

Apart from the issue of not found babel-node executable, I'd strongly recommend avoiding using babel-node to run/debug your code. I'd suggest using -r babel-register instead. Just create a .babelrc like

{
  "presets": ["env"]
}

and then use a configuration like the follows to run/debug your application:

enter image description here

于 2019-03-15T12:45:46.487 回答