tcurdt
October 25, 2020, 11:54pm
1
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?
jan
October 26, 2020, 7:47am
2
Best to use an existing n8n image as base as described here:
Welcome to the community @Rodrigo_Meyer !
Probably best if you build your own custom image based on the one of n8n.
So you create a file named “Dockerfile” with this content:
FROM n8nio/n8n
RUN npm install -g easy-pdf-merge
In the same folder you execute then this command to build it:
docker build -t n8n-pdf
If you then use this image and start n8n like this:
docker run -it --rm --name n8n -p 5678:5678 -e NODE_FUNCTION_ALLOW_EXTERNAL=easy-pdf-merge -v ~/.n8n:/root/.n8n n8n-pdf
the libra…
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.
tcurdt
October 26, 2020, 9:50am
3
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?
jan
October 26, 2020, 10:14am
4
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.
tcurdt
October 26, 2020, 10:42am
5
I was just referring to the documentation.
So the docs are just outdated?
jan
October 26, 2020, 12:35pm
6
Ah yes, that is simply wrong. I just fixed it on GitHub and will be updated on the website tomorrow.
1 Like