-1

I have a new project folder configured and running with express.js and the server is running fine on port 3000. I have installed nodemon globally using the sudo command so I expect I don't need to add this as a dependency or locally within the project.

When installing nodemon there are no errors, however when i fire the command nodemon server.js the command line essentially doesn't do anything and stops accepting commands.

I'm wondering if I'm missing something and hoping someone can point me in the right direction. Thanks in advance for your time.

Nick
  • 185
  • 2
  • 14
  • _"I have installed nodemon globally using the sudo command"_ How? – jabaa Sep 27 '21 at 08:50
  • I used sudo npm install -g nodemon – Nick Sep 27 '21 at 08:55
  • Does it work with a local `nodemon` or does `nodemon` not work at all? What operating system do you use? – jabaa Sep 27 '21 at 09:02
  • Try using `sudo` command for running nodemon – Harshit Rastogi Sep 27 '21 at 09:05
  • Don't install packages with `sudo` and don't run commands with `sudo`. Fix your system with https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally `nodeman` has to watch many files. Is it possible that your system can't handle that many files? – jabaa Sep 27 '21 at 09:06
  • Using a mac and have only tried with this one project which I'm basically just starting, it's doing nothing except running a few requests for a couple of blank pages. I'll try uninstalling and re-installing using the command specified. The sudo command was recommended by the course im running through currently – Nick Sep 27 '21 at 09:09
  • _"The sudo command was recommended by the course im running through currently"_ That's usually a sign for a very bad course. That could mean that the tutor doesn't have any real world experience and doesn't know best practices. Have you tried to install `nodemon` locally instead of globally? Does it change anything? You could try to run `nodemon` in sandbox project with only one file that contains something like `console.log('Test');`. – jabaa Sep 27 '21 at 10:24
  • The course is run by Angela Yu founder of the app brewery. She's pretty knowledgeable. Her course is one of the most recommended. I wanted to install globally to use across many projects than have to install manually for each one. I'll give it another go locally after work tonight. Thanks for your help guys – Nick Sep 27 '21 at 11:16
  • Recommending unnecessary `sudo` in a beginners course doesn't look like she's pretty knowledgeable in this topic. – jabaa Sep 27 '21 at 11:50

2 Answers2

-1

Use npm install -g nodemon this command to install nodemon globally and try to run nodemon [your node app]. For better understanding go through link.

Jay Patel
  • 1,098
  • 7
  • 22
-1

Evening all, thanks for your contributions earlier, essentially things were mixed up with the course since the updates which was causing my issue.

Previously it looks like you would install express and run server.js through your designated port and then boot up nodemon. This no longer works and was causing the issue I was having.

Now you simply just boot up nodemon via the command nodemon server.js and it handles the rest. This wasn't really outlined in the documentation.

I was expecting to boot up localhost and then use nodemon to watch for changes. Looks like the new method is much more efficient

Thanks for the help

Nick
  • 185
  • 2
  • 14