Having a problem getting n8n up and running after installing a NPM package.
I created a directory, in there npm installed the package and mounted the volume in my docker-compose.yml. I also set the NODE_FUNCTION_ALLOW_EXTERNAL env variable.
Before doing this my n8n instance ran perfectly. Currently I get the error
n8n-1 | /docker-entrypoint.sh: exec: line 7: n8n: not found
Dockerfile
version: "3.7"
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- NODE_FUNCTION_ALLOW_EXTERNAL=maizzle
volumes:
- n8n_data:/home/node/.n8n
- /local-files:/files
- ./maizzle_module:/usr/local/lib/node_modules
volumes:
traefik_data:
external: true
n8n_data:
external: true
It looks like your topic is missing some important information. Could you provide the following if applicable.
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
Hey @victorb,
I suspect the issue is likely where you are replacing the node_modules folder in your container with your local version which won’t contain n8n.
If you are trying to install an npm package the best option is to use a custom image which you can do using the below dockerfile.
FROM docker.n8n.io/n8nio/n8n
USER root
RUN npm install -g x
USER node
Hi Jon,
This fixed the original error and made me able to run n8n again but using the installed package inside the Code node does not seem to work.
I’ve installed both the maizzle and @maizzle/framework packages with this dockerfile and pushed it to my registry
FROM docker.n8n.io/n8nio/n8n
USER root
RUN npm install -g maizzle @maizzle/framework
USER node
Changed the NODE_FUNCTION_ALLOW_EXTERNAL environment variable to * in docker-compose.yml
However, trying to get the package to work using const Maizzle = require("maizzle"); (or @maizzle/framework) results in an error that the package has not been found by n8n.
Still haven’t been able to get this working myself sadly
Hey @victorb,
What is the full error you are seeing? Are you also actually using your custom image and not docker.n8n.io/n8nio/n8n in your compose file?
Yes, I’m using my custom image.
The full error is: