Describe the problem/error/question
I am trying to use langchain inside a N8N Code Node. I read everything about that and nothing. this is my Dockerfile
FROM docker.n8n.io/n8nio/n8n
USER root
RUN cd /usr/local/lib/node_modules/n8n/node_modules && npm install langchain
This is the environment of my docker-compose.yml
environment:
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_BASIC_AUTH_ACTIVE=TRUE
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- NODE_FUNCTION_ALLOW_BUILTIN=*
- NODE_FUNCTION_ALLOW_EXTERNAL= opeanai,langchain,dotenv**
What is the error message (if any)?
When I build container using this command
docker compose up -d --build
I got this error
=> ERROR [n8n 2/2] RUN cd /usr/local/lib/node_modules/n8n/node_modules 55.2s
[n8n 2/2] RUN cd /usr/local/lib/node_modules/n8n/node_modules && npm install langchain:
55.10 npm ERR! code ERESOLVE
55.10 npm ERR! ERESOLVE could not resolve
55.10 npm ERR!
55.10 npm ERR! While resolving: [email protected]
55.10 npm ERR! Found: [email protected]
55.10 npm ERR! node_modules/mysql2
55.10 npm ERR! mysql2@“~2.3.0” from [email protected]
55.10 npm ERR! node_modules/n8n-nodes-base
55.10 npm ERR! n8n-nodes-base@“1.9.3” from the root project
55.10 npm ERR! peerOptional mysql2@“^2.2.5 || ^3.0.1” from [email protected]
55.10 npm ERR! node_modules/typeorm
55.10 npm ERR! typeorm@“^0.3.17” from the root project
55.10 npm ERR! peerOptional typeorm@“^0.3.12” from [email protected]
55.11 npm ERR! node_modules/langchain
55.11 npm ERR! langchain@“" from the root project
55.11 npm ERR! 1 more (the root project)
55.11 npm ERR!
55.11 npm ERR! Could not resolve dependency:
55.11 npm ERR! peerOptional mysql2@“^3.3.3” from [email protected]
55.11 npm ERR! node_modules/langchain
55.11 npm ERR! langchain@"” from the root project
55.11 npm ERR!
55.11 npm ERR! Conflicting peer dependency: [email protected]
55.11 npm ERR! node_modules/mysql2
55.11 npm ERR! peerOptional mysql2@“^3.3.3” from [email protected]
55.11 npm ERR! node_modules/langchain
55.11 npm ERR! langchain@“*” from the root project
55.11 npm ERR!
55.11 npm ERR! Fix the upstream dependency conflict, or retry
55.11 npm ERR! this command with --force or --legacy-peer-deps
55.11 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
55.11 npm ERR!
55.11 npm ERR!
55.11 npm ERR! For a full report see:
55.11 npm ERR! /root/.npm/_logs/2023-10-15T21_06_28_755Z-eresolve-report.txt
55.11
55.11 npm ERR! A complete log of this run can be found in:
55.11 npm ERR! /root/.npm/_logs/2023-10-15T21_06_28_755Z-debug-0.log
failed to solve: process “/bin/sh -c cd /usr/local/lib/node_modules/n8n/node_modules && npm install langchain” did not complete successfully: exit code: 1
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: