admin管理员组

文章数量:1336177

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.

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.

Share edited Mar 5, 2020 at 6:39 AmerllicA 32.8k17 gold badges143 silver badges167 bronze badges asked Apr 18, 2016 at 23:36 ArchNoobArchNoob 4,1265 gold badges34 silver badges59 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 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

本文标签: javascriptnodemon Cannot find module 39pathtoprojecthomeindexjs39Stack Overflow