Install n8n-nodes-module in custom n8n image


I am currently trying to install a custom node module in a n8n docker image. This part of the docs describes the recommended steps to install the module using the default n8n Dockerfile.

However, I’m building the n8n custom image and would like to know:

  • When should the module be installed (builder or final stage)?
  • Where should the module be installed (/usr/local/lib/node_modules/n8n does not exist)?

Thanks for your help

Hey @hchris1, from taking a quick look it seems the n8n build in the custom image is using the /data directory: n8n/Dockerfile at c45ab96559932972b4694b42e7a55a580173ac1d · n8n-io/n8n · GitHub

Can you double-check this against your container built using n8n-custom (I am currently on a somewhat low-spec Windows PC where my build won’t finish before my next meeting, so can’t test this first hand)?

Hey @MutedJam,

thanks for your response. I don’t have the container at hand right now as well but I can remember that the package.json of n8n and its node_modules are located in the /data directory.

So the custom node module should be installed in the second stage of the build process in the /data directory, right?


I never understand the way they take for n8n custom (but I learn on my own, so I probably do the wrong way :stuck_out_tongue: )
But still it work enough for me

see my last post : Node:lts - no more the error npm run build - #6 by Dtneo
Dockerfile + docker-compose (+ add your own .env)
It work for me, I can write my own new node on my computer.
And for test, I just restart the docker-compose.

Good luck

Hi @Dtneo,

thank you for your comment. From the first glance on your last post it seems like you mount your custom node directory in your docker container, right?

I am currently using a similar solution but don’t think that this is the intended way. Your nodes show up in a ‘custom’ tab in the node selection menu. If you add a json file to your custom nodes specifying a node category, the node shows in both the custom category and the one defined by you. This is something I’d like to avoid.

I don’t think it is like you write.

I don’t know what is custom category.
In UI editor I juste write my own node and find it.

I would use the json file for add it in a category but still to much error on my node for testing it :stuck_out_tongue:
So sorry, I can’t test with my own node this morning

With my way, my custom node is like every other, the disadvantages are therefore :

  • I have to update manually the package.json file every time I want update a new version of n8n, and add every line I need for each custom node.
  • the docker compose have to be specific for each custom node (add volume for credential and node folder).

@Dtneo I see, then I slightly missunderstood your other post. Still looking for a nicer way to do this as I don’t want to manually add nodes everytime I update n8n. Thanks for explaining your approach!

1 Like

I don’t make test or try it, but n8n team have work on environment variable for docker.
maybe you have time top study it.

@MutedJam Would it be possible to clarify on this question from one of my posts above?

Hey, sorry I didn’t get to answering your post yet. I’ve blocked some time tomorrow to play around with the custom image and see what I can come up with.

@MutedJam Thank you for taking the time! I had some time playing around this evening but couldn’t get it working yet. I still wanted to share what I’ve tried so far.

To begin with I made sure that the n8n installation is located in the /data folder:
This is looking as expected. I also had a look in the prebuilt n8n container and there the n8n installation is in the location described in n8n-docs for installing custom node modules. The /data folder is empty there. Seeing this I thought it should be fine to install the custom node module in the /data folder for the custom built container.

Installation attempts

I used the @digital-boss/n8n-nodes-supportpal package for testing. I tried some other ones as well but the results were identical.

Installation in the second stage

Changes made

I inserted the npm install command after copying the data directory from the builder. The workdir is already set to the /data directory so no need to cd into it.

COPY --from=builder /data ./

# Inserted line
RUN npm install @digital-boss/n8n-nodes-supportpal

COPY docker/images/n8n-custom/ /


An error occurs on n8n startup:

  throw err;

Error: Cannot find module '@oclif/command'
Require stack:
- /data/packages/cli/bin/n8n
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/data/packages/cli/bin/n8n:32:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  requireStack: [ '/data/packages/cli/bin/n8n' ]

Installation in the first stage (builder)

Changes made

I inserted the npm install command even before building n8n. I honestly don’t know if that makes any sense but thought it might help to do it before running lerna for fixing dependency issues.


COPY lerna.json .
COPY package.json .
COPY packages/cli/ ./packages/cli/
COPY packages/core/ ./packages/core/
COPY packages/design-system/ ./packages/design-system/
COPY packages/editor-ui/ ./packages/editor-ui/
COPY packages/nodes-base/ ./packages/nodes-base/
COPY packages/workflow/ ./packages/workflow/
RUN rm -rf node_modules packages/*/node_modules packages/*/dist

# Inserted line
RUN npm install @digital-boss/n8n-nodes-supportpal

RUN npm config set legacy-peer-deps true
RUN npm install --production --loglevel notice
RUN lerna bootstrap --hoist -- --production
RUN npm run build


There is no error thrown upon n8n startup but I don’t see the custom nodes showing up.

Hey @hchris1, unfortunately I couldn’t figure it out either :frowning:

I have asked the team internally if anyone has any suggestion on this (and will of course share the feedback once I got this working). I suppose there is no chance you can use one of the regular n8n docker images (in which node-modules could be installed as described here)?

1 Like

Hey @MutedJam,

I made a couple of changes in the styling to match my other applications I have running at home. That’s why I would like to stick to the custom image. I think that this is something that should work and I want to help as much as I can to find a solution.

When we find a solution, I would be happy to create a PR to add that info to n8n-docs.

Thanks for keeping me updated!

1 Like

Hey @MutedJam,
did you already get any feedback from the n8n team?
Thanks again for your help

Unfortunately not, there were some suggestions like adding the respective module directly to the package.json file, but none of them would work for me. So I think you might be best of with simply waiting until sideloading of such module is properly implemented and available directly in the UI :frowning: