I am trying to set up a repository to create a custom node.
Since I want to share this repo between machines (with different OS), including the flows and custom nodes, I want to configure node-red to run locally from the repository's node_modules instead of installing it globally.
For a vanilla, non-docker solution, I think you are on the right lines. Maybe have a look at the alternate installer repo on my GitHub for ideas though, that presents a way of quickly creating local installed instances of node-red with a userDir that is contained within the master node-red folder so everything is in 1 place.
If you wanted to share a locally developed node into an instance, it is better to make sure that the node's folder has a proper package.json file. Then you can "install" it with npm install /nodes/mynode` or wherever you've put it (in its own sub-folder). That lets npm and node.js manage things for you.
it throws a MODULE_NOT_FOUND error which node-red ignores.
I already did an npm install ./nodes/my-node but looks like it did not fix anything. (the package was copied to the repo root node_modules)
Besides that, I think npm install is not the best way if I want to keep the source code and the deployed node in sync.
I use it constantly. My dev PC runs Node-RED under PM2 and I use its watch function to watch for changes to any files/folders that need a Node-RED restart. So I can edit my custom nodes and each change saved triggers a restart of Node-RED.
The type is defined in the modules package.json file. Details are in the node-red docs.