Why nodemon fail when using -- exec babel-node?
The reason is because you are not sending anything to babel to transpire and run. nodemon just looks for file changes.
Try this instead.
"serve":nodemon --exec babel-node src/index.js
If that doesn't work make sure you have the proper DEV dependencies.
@babel/core
@babel/node
@babel/cli
@babel/preset-env
configure .babelrc to have the following
{
"presets" : ["@babel/preset-env"]
}
I ran into the same problem and solved it this way: "scripts": { "start": "babel-node src/index.js" "dev" : "nodemon --exec npm start" }