Installing node modules within workflow

Hi,

I’m trying to use some node modules within my workflow. Let’s say, for the sake of simplicity, node-fetch is one of them. I don’t want to run the container with root user, and node user cannot install global modules.

So, I tried to install it via Execute Command node. It goes through, I can see the new module showing up in /usr/local/lib/node_modules/n8n/node_modules folder, but in the very next node when I try to import it, workflow fails. Similarly, I also tried to install it within a Code node, like this: (spoiler alert: it fails)

Nothing I tried worked so far. I’m clueless how to add external node modules. Help, please?

PS: I have NODE_FUNCTION_ALLOW_EXTERNAL set, but I’m not building my own Docker container. I just pull it from the registry and run directly. It’s important for the maintainability in the long run, so creating a custom build and whatnot is not a viable solution. It needs to be resolved within workflow scope, if possible.

Thanks in advance.