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

I am using nodmeon version 1.9.1 on a linux machine.

I run nodemon using nodemon --watch ./build , where I have the contents of index.js in the build folder.

But when I run nodemon, it continues to search for the index.js file in the project home folder, so it throws an error because it cannot find it there.

I tried checking nodemon --help for a better option, but I can't see it, and also wrote it in the package.json file in the scripts object, which it still causes the same error.

I also tried to run it, since nodemon --watch ./build/index.js still throws an error.

Also the index.js file contains only console.log('hello world'); to make sure it is nodemon .

+6
source share
1 answer

Your use of --watch disables nodemon.

What you say to nodemon is "running fine and browsing the ./build directory". nodemon looks for the parameter after --watch and finds ./build . Then it searches for the script, does not find it, and therefore uses the default value.

Nodemon clock by default, so you want to run nodemon ./build

+6
source

All Articles