Build failed in docker containers for images v0.193.0 and above

I am trying to build the ‘n8n-nodes-starter’ project according to the tutorial on youtube.
The problem is that the build fails when using docker image 0.193.0 or later with the following error:

[4/4] RUN cd /n8n-nodes-starter && npm i && npm run build && npm pack     && cd /usr/local/lib/node_modules/n8n && npm install /n8n-nodes-starter/n8n-nodes-my-first-node-0.1.0.tgz:
#8 3.154
#8 3.154 up to date in 2s
#8 3.745
#8 3.745 > [email protected] build
#8 3.745 > tsc && gulp build:icons
#8 3.745
#8 3.751 sh: tsc: not found

In the tutorial 0.190.0 is used and it works as well as 0.192.0.
Is something changed in the images or is it a bug?

Hey @pavvel,

There was an update but it should install everything, Can you share your Dockerfile?

Hi @Jon

Here is my Dockerfile:

ARG N8N_VESRION
FROM n8nio/n8n:$N8N_VESRION

RUN mkdir /n8n-nodes-starter
COPY . /n8n-nodes-starter
RUN cd /n8n-nodes-starter && npm i && npm run build && npm pack \
    && cd /usr/local/lib/node_modules/n8n && npm install /n8n-nodes-starter/n8n-nodes-my-first-node-0.1.0.tgz

It is the same as in the tutorial, except for the name of the node.
Please be aware that without changing anything in Dockerfile or anywhere in the node code on the previous version of the docker image it just works.

1 Like

Hi @pavvel ,
Same problem here. Could you solve it ? How do you build your nodes on n8nio/n8n’s Dockerfile yet ?
Cheers,
Jonas

Hi @jonas-lauber
I did not resolve the issue, but to be honest I did not try much.
I was waiting for any information from n8n Team.

Regards, Pawel.

I have just managed to build a custom image using the steps we have on our main repo, It could be worth starting with that.

Hi @Jon,
Have you tried to build a custom node?
Could you please paste the link to the steps and the example of the Dockerfile which worked for you?

Hey @pavvel,

I have just updated one of my community nodes with an example Dockerfile which works.

The the should be generic enough to just work with any community node if you wanted to build an image that way and not publish it to npm.

The Dockerfile itself looks like this…

ARG N8N_VERSION
FROM n8nio/n8n:$N8N_VERSION

RUN npm config set -g production false

RUN mkdir /working-dir
COPY . /working-dir
RUN cd /working-dir && npm install && npm run build && npm pack && \
	cd /usr/local/lib/node_modules/n8n && npm install /working-dir/*.tgz

RUN rm -rf /working-dir

RUN npm config set -g production true

Thank you, @Jon. Your Dockerfile solved the problem. RUN npm config set -g production false command was missing in my file which caused build was failing.

1 Like

Hey @pavvel,

I had to do some digging to find that one, It turns out if node is in production mode it won’t install the dev dependencies and it causes the failures.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.