Install npm package on n8n heroku

Describe the problem/error/question

I’ve installed N8N on Heroku with one-click deploy (GitHub - n8n-io/n8n-heroku)

I’d like to install a npm package now, but I don’t understand how I can do it.

Should I modify the dockerfile ?

Hey @ajubin,

Welcome to the community :cake:

In the n8n ui you can go to Settings > Community Nodes and input the name of the node you want to install, If you want to use an npm package instead you will need to create your own docker image.

1 Like

Thanks for the answer,

I’ve managed to find a solution by:

  • modifying my dockerfile as below
  • adding a package.json with my-npm-library
  • adding in NODE_FUNCTION_ALLOW_EXTERNAL=my-npm-library
FROM n8nio/n8n:latest

USER root

WORKDIR /home/node/packages/cli

# following line were added
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm install
RUN cp -a node_modules/. /usr/local/lib/node_modules/


COPY ./ /
RUN chmod +x /
CMD ["/"]

1 Like