From beb8d94d419f7dbc310e492d1daa473f3374af30 Mon Sep 17 00:00:00 2001 From: SashkoMarchuk Date: Sun, 23 Nov 2025 14:24:18 +0100 Subject: [PATCH] Add tiktoken npm package to n8n for token counting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added tiktoken package installation to Dockerfile.n8n - Set TIKTOKEN_VERSION build argument (^1.0.21) - Added tiktoken to NODE_FUNCTION_ALLOW_EXTERNAL allowlist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Dockerfile.n8n | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.n8n b/Dockerfile.n8n index b8c58ba..819cba2 100644 --- a/Dockerfile.n8n +++ b/Dockerfile.n8n @@ -5,6 +5,7 @@ ARG NODE_ENV=production ARG N8N_PORT=5678 ARG SHOWDOWN_VERSION=^2.1.0 ARG SLACKIFY_MARKDOWN_VERSION=^4.5.0 +ARG TIKTOKEN_VERSION=^1.0.21 # Install git for backup script and other packages + install external packages in one layer USER root @@ -14,11 +15,12 @@ RUN set -eux; \ --legacy-peer-deps --no-workspaces \ --unsafe-perm \ showdown@${SHOWDOWN_VERSION} \ - slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} && \ + slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} \ + tiktoken@${TIKTOKEN_VERSION} && \ npm cache clean --force # Configure external modules allowlist used by Code/Function nodes -ENV NODE_FUNCTION_ALLOW_EXTERNAL="showdown,slackify-markdown" +ENV NODE_FUNCTION_ALLOW_EXTERNAL="showdown,slackify-markdown,tiktoken" # Create app directory WORKDIR /home/node