Adding packages to a docker install

I am looking at getting some code into n8n. Be it as function or custom node.
Either way I am wondering how to add the necessary npm packages into my docker container. Any pointers?

I also found GitHub - n8n-io/n8n-nodes-starter: Example starter module for custom n8n nodes. - I guess that’s the place to start for custom noes? I am not so eager to add typescript as another hurdle. Are there also some js nodes I could use as boilerplate?

Best to use an existing n8n image as base as described here:

Yes that is what you can use as a base or use: n8n/packages/node-dev at master · n8n-io/n8n · GitHub

All nodes got written in TypeScript. If you want JavaScript examples you can look into the published npm packages. There they are all “converted” into JavaScript.

Thanks!

For future readers this link to the docs is probably also worth reading. I thought I can just use

NODE_FUNCTION_ALLOW_EXTERNAL=*

and then do a build in the docker compose that does the npm install in my Dockerfile.
But “Wildcard matching is not supported” :-/

If that is for security reasons - isn’t that a bit over the top?

Did you test that and it did not work? Because it should work totally fine. I even just tested it and it works totally fine for me. So I am a little bit confused about what you are writing.

I was just referring to the documentation.
So the docs are just outdated?

Ah yes, that is simply wrong. I just fixed it on GitHub and will be updated on the website tomorrow.

1 Like