7

I'm using nodmeon version 1.9.1 on a Linux machine.

I'm running nodemon with: nodemon --watch ./build where I have my index.js content in the build folder.

But when I run nodemon it keeps looking for index.js file at the project's home folder hence it throws an error because it cannot find it there.

I tried to check nodemon --help for any better option but I don't see any and also wrote it in package.json file in scripts object it still throws the same error.

I've also tried to run it as nodemon --watch ./build/index.js still throws the error.

Also, the index.js file only contains a console.log('hello world'); just to make sure, it's nodemon itself.

AmerllicA
  • 29,059
  • 15
  • 130
  • 154
ArchNoob
  • 3,946
  • 5
  • 32
  • 59

1 Answers1

7

Your use of --watch is throwing nodemon off.

What you're telling nodemon is "run normally, and watch the directory ./build". nodemon is looking for a parameter after --watch and finds ./build. It then looks for a script, finds none, and thus uses the default.

Nodemon watches by default so what you want to run is nodemon ./build

SomeKittens
  • 38,868
  • 19
  • 114
  • 143
  • It worked, thank you. I took long to respond because something else went wrong, fixed it and it's great now. Thanks! – ArchNoob Apr 18 '16 at 23:56