'electron' is not recognized as an internal or external command when using nodemon

I have the following scripts in my electron js app's package.json

"start": "electron .",
"dev": "nodemon --exec electron ."

butI get the following error when I run the app as npm run dev

'electron' is not recognized as an internal or external command, operable program or batch file

and the app crashes. However, when I run it as npm start it runs fine with no issues.

What maybe the issue with nodemon?