Hey there,
I created a post that deals with it.
You’ll find a Github repository that make custom nodes work in a devcontainer. If you want to use it locally, just give a look at the .devcontainer file and search for the initialisation scripts.
Basically, it just involves launching n8n to create ~/.n8n and then creating ~/.n8n/custom directory and then running pnpm link PATH_TO_CUSTOM_NODE inside it so that n8n knows it exists.