Hey
Describe the problem/error/question
I needed a customized node so I created an app (Typescript) that I run locally with my own nodes and I’ve to npm link n8n to serve that on my localhost and see my nodes.
What is the error message (if any)?
I’m trying to dockerize the app with Dockerfile, but when I try to build the image it says that Cannot find module ‘n8n-workflow’
The error:
[+] Building 19.8s (12/14) => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 415B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/n8nio/n8n:latest 0.7s => [ 1/10] FROM docker.io/n8nio/n8n:latest@sha256:81f60515c7d8b754b001af5a4079dd6b47e4d5179c5ca569670e992bd4f4b782 0.0s => [internal] load build context 0.7s => => transferring context: 941.70kB 0.6s => CACHED [ 2/10] RUN npm install --global --unsafe-perm n8n typescript 0.0s => CACHED [ 3/10] WORKDIR /usr/src/app 0.0s => CACHED [ 4/10] COPY package*.json ./ 0.0s => [ 5/10] COPY . . 1.6s => [ 6/10] RUN npm install 10.2s => [ 7/10] RUN npm install typescript 3.1s => ERROR [ 8/10] RUN npm run build && npm link 3.3s ------ > [ 8/10] RUN npm run build && npm link: #12 1.011 #12 1.011 > [email protected] build #12 1.011 > tsc && gulp build:icons #12 1.011 #12 3.254 credentials/StellarApi.credentials.ts(1,50): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.255 nodes/Stellar/Stellar.node.ts(6,8): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.255 nodes/Stellar/actions/newAccount/createAccount/execute.ts(2,40): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.256 nodes/Stellar/actions/newAccount/fundAccount/execute.ts(2,61): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.257 nodes/Stellar/actions/newAccount/index.ts(1,33): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.257 nodes/Stellar/actions/payments/getPayment/description.ts(1,33): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.257 nodes/Stellar/actions/payments/getPayment/execute.ts(1,35): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.257 nodes/Stellar/actions/payments/index.ts(1,33): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.258 nodes/Stellar/actions/router.ts(1,68): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.258 nodes/Stellar/actions/router.ts(22,26): error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'typeof import("/usr/src/app/nodes/Stellar/actions/payments/index")'. #12 3.258 nodes/Stellar/actions/swapAssets/index.ts(1,33): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.258 nodes/Stellar/actions/swapAssets/swap/description.ts(1,33): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.258 nodes/Stellar/actions/swapAssets/swap/execute.ts(1,35): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. #12 3.258 nodes/Stellar/transport/index.ts(1,40): error TS2307: Cannot find module 'n8n-workflow' or its corresponding type declarations. ------ executor failed running [/bin/sh -c npm run build && npm link]: exit code: 2
My Dockerfile:
ARG N8N_VERSION=latest
FROM n8nio/n8n:$N8N_VERSION as build
RUN npm install --global --unsafe-perm n8n typescript
WORKDIR /usr/src/app
COPY package*.json ./
COPY . .
RUN npm install
RUN npm run build && npm link
WORKDIR /usr/local/lib/node_modules/n8n
RUN npm link n8n-nodes-stellar
CMD ["n8n", "start"]
EXPOSE 5678
And my package.json:
{
"name": "n8n-nodes-stellar",
"version": "0.1.0",
"description": "",
"keywords": [
"n8n-community-node-package"
],
"license": "MIT",
"homepage": "",
"author": {
"name": "",
"email": ""
},
"repository": {
"type": "git",
"url": "https://github.com/<...>/n8n-nodes-<...>.git"
},
"main": "index.js",
"scripts": {
"build": "tsc && gulp build:icons",
"dev": "tsc --watch",
"format": "prettier nodes credentials --write",
"lint": "eslint nodes credentials package.json",
"lintfix": "eslint nodes credentials package.json --fix",
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes credentials package.json",
"test": "vitest nodes"
},
"files": [
"dist"
],
"n8n": {
"n8nNodesApiVersion": 1,
"credentials": [
"dist/credentials/StellarApi.credentials.js"
],
"nodes": [
"dist/nodes/Stellar/Stellar.node.js"
]
},
"devDependencies": {
"@types/express": "^4.17.6",
"@types/request-promise-native": "~1.0.15",
"@typescript-eslint/parser": "~5.45",
"eslint-plugin-n8n-nodes-base": "^1.11.0",
"gulp": "^4.0.2",
"n8n-core": "*",
"n8n-workflow": "*",
"prettier": "^2.7.1",
"typescript": "~4.8.4",
"vitest": "^0.29.2"
},
"dependencies": {
"stellar-sdk": "^10.4.1"
}
}
Information on your n8n setup
- **n8n version:*latest
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- **Running n8n via (Docker, npm, n8n cloud, desktop app):Dockerfile
- **Operating system:*Windows