Install npm packet for use via “Function Item”

Can I install npm package node-html-parser inside n8n to use it using the “Function or Function Item” node?. I running n8n from Docker

Yes, you can use the n8n image as a base and then install additional modules in your own image. You just have to make sure to specifically allow that odule it to be used inside of Function-Nodes:

export NODE_FUNCTION_ALLOW_EXTERNAL=node-html-parser

You can find the documentation here:
https://docs.n8n.io/reference/configuration.html#use-built-in-and-external-modules-in-function-nodes

But you can also simply use cheerio. That modules already gets used by n8n with the HTML Extract-Node. So installing an additional module is so not needed and you can use the default image. You just have to set:

export NODE_FUNCTION_ALLOW_EXTERNAL=cheerio
2 Likes