I'm no fan of the node_modules structure. I'd have gone for a dichotomy, node_library and node_modules. node_library would be the place that npm and yarn install stuff from npmjs.org. node_modules would be for my modules and other code. I would have node search up the tree in both folders. Complicated, yes. But having no systematic way of determining which code is mine is simply awful.
In one of the goofiest decisions in the node world, the project monitor, nodemon, does not look inside node_modules to figure out whether to restart a project when files are changed. This is certainly because it has to monitor a zillion files if it does and the guy worries about performance.
The problem is that my projects are comprised of node modules and they are put in node_modules. If there is a better place to put them, I beg you, write some comments and save me and the rest of the misery.
So, if you
cannot get nodemon to restart your project or
nodemon won't detect changed files
nodemon will not watch node_modules
(put search phrases in the comments, please)
you can remedy the situation by adding an ignoreRoot key to you nodemon.json file
"ignoreRoot": [".git", ".jpg", ".whatever"]
This overrides the default ignore behavior entirely. Choosing to not list node_modules means they can now be watched.
This is, in fact, explained on the github site (here
) but, you have to read a lot of stuff to get to it and it doesn't get found by google.
Perhaps this will change that.