Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodemon Cannot find module '/path/to/project/home/index.js'

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.

like image 676
ArchNoob Avatar asked Apr 18 '16 23:04

ArchNoob


1 Answers

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

like image 113
SomeKittens Avatar answered Sep 24 '22 03:09

SomeKittens