If nodemon server.js doesn't execute nodemon but rather opens the file, one can assume that the OS did not get the executable nodemon app and therefore thought: "Oh! nodemon is a file itself". There also might be a misalignment of nodemon and the node in your system; as in they might be in separate locations.
You can do:
where node
in Powershell and see where node is. Then check for nodemon with:
where nodemon
If it misaligns, do:
npm uninstall -g nodemon
npm cache clean --force
You can recheck with:
where nodemon
If anything is still there, then manually delete it.
Finally, check for node_modules location and reinstall nodemon.
Recheck with:
npm root -g
and install with:
npm install -g nodemon
Wishing it helps.