0

I installed nodemon globally and locally I added it to the environment path. I tried to use flags but nothing works

nodemon run fails

One month ago (last time I used it), it was running completely fine. Now it's opening nodemon.js in the text editor and I tried everything and nothing worked.

  • Nodemon 3.1.10
  • Node 22.18.0
  • npm 11.4.1

2 Answers 2

0

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.

Sign up to request clarification or add additional context in comments.

Comments

-1

You can use typescript to run your server:

"scripts": {
    "dev": "tsx watch src/index.ts",
    "build": "tsc",
    "start": "node dist/index.js",
}

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
How does this address the underlying concern? How is this related to nodemon at all?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.