Creation of custom node

Hello I just started to create nodes to help at my scale the development of n8n. To start I followed the tutorial proposed on https://docs.n8n.io/nodes/creating-nodes/create-node.html#adding-the-node-to-editor-ui
But here it does not work when compiling and launching n8n. Here is the error on my terminal:
PS E:\ordinateur\n8n node\n8n> npm run build

> build
> lerna exec npm run build

lerna notice cli v4.0.0
lerna info versioning independent
lerna info Executing command in 6 packages: "npm run build"

> [email protected] build
> tsc


> [email protected] build
> tsc

error TS2688: Cannot find type definition file for 'node'.
  The file is in the program because:
    Entry point of type library 'node' specified in compilerOptions

    7    "node"
         ~~~~~~
    File is entry point of type library specified here.


Found 1 error.

lerna ERR! npm run build exited 2 in 'n8n-node-dev'
lerna ERR! npm run build exited 2 in 'n8n-node-dev'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
PS E:\ordinateur\n8n node\n8n> npm run dev

> dev
> lerna exec npm run dev --parallel

error TS2688: Cannot find type definition file for 'jest'.
  The file is in the program because:
    Entry point of type library 'jest' specified in compilerOptions

  tsconfig.json:9:4
    9    "jest"
         ~~~~~~
    File is entry point of type library specified here.

error TS2688: Cannot find type definition file for 'node'.
  The file is in the program because:
    Entry point of type library 'node' specified in compilerOptions

  tsconfig.json:8:4
    8    "node",
         ~~~~~~
    File is entry point of type library specified here.


Found 2 errors.

lerna notice cli v4.0.0
lerna info versioning independent
lerna info Executing command in 6 packages: "npm run dev"
n8n-core: > [email protected] dev
n8n-core: > npm run watch
n8n-editor-ui: > [email protected] dev
n8n-editor-ui: > npm run serve
n8n-workflow: > [email protected] dev
n8n-workflow: > npm run watch
n8n-nodes-base: > [email protected] dev
n8n-nodes-base: > npm run watch
n8n: > [email protected] dev
n8n: > concurrently -k -n "TypeScript,Node" -c "yellow.bold,cyan.bold" "npm run watch" "nodemon"
n8n-node-dev: > [email protected] dev
n8n-node-dev: > npm run watch
n8n: 'concurrently' n'est pas reconnu en tant que commande interne
n8n: ou externe, un programme ex�cutable ou un fichier de commandes.
lerna ERR! npm run dev exited 1 in 'n8n'
lerna ERR! npm run dev stdout:

> [email protected] dev
> concurrently -k -n "TypeScript,Node" -c "yellow.bold,cyan.bold" "npm run watch" "nodemon"

lerna ERR! npm run dev stderr:
'concurrently' n'est pas reconnu en tant que commande interne
ou externe, un programme ex�cutable ou un fichier de commandes.
lerna ERR! npm run dev exited 1 in 'n8n'
lerna WARN complete Waiting for 5 child processes to exit. CTRL-C to exit immediately.
PS E:\ordinateur\n8n node\n8n>

Welcome to the community @simon_Piquemal

Did you do the lerna bootstrap --hoist before running the npm run build?

yes I did that.

I forgot to say, I’m on Window 10

My coworker @ivov uses window. Perhaps, he has a better insight.

1 Like

To install on Windows:

npm install -g windows-build-tools
npm i lerna -g
npm i n8n-node-dev -g
git clone https://github.com/n8n-io/n8n.git
cd n8n
lerna bootstrap --hoist
npm run build
npm run start
2 Likes

impossible to execute the first command line.

Is that the full error message?

You may be missing administrative rights - try running PS as administrator.

1 Like

Windows PowerShell
Copyright (C) Microsoft Corporation. Tous droits réservés.

Testez le nouveau système multiplateforme PowerShell https://aka.ms/pscore6
Cloning into 'n8n'...
remote: Enumerating objects: 37355, done.
remote: Counting objects: 100% (3793/3793), done.
remote: Compressing objects: 100% (1727/1727), done.
remote: Total 37355 (delta 2538), reused 3063 (delta 2026), pack-reused 33562Receiving objects: 100% (37355/37355), 9.86Receiving objects: 100% (37355/37355), 9.98 MiB | 274.00 KiB/s
, done.
Resolving deltas: 100% (28645/28645), done.
Updating files: 100% (1973/1973), done.
PS E:\ordinateur\n8n node> cd n8n
PS E:\ordinateur\n8n node\n8n> lerna bootstrap --hoist
lerna notice cli v4.0.0
lerna info versioning independent
lerna info Bootstrapping 6 packages
lerna WARN EHOIST_PKG_VERSION "n8n" package depends on @types/[email protected], which differs from the hoisted @types/[email protected]^14.14.40.
lerna WARN EHOIST_PKG_VERSION "n8n-editor-ui" package depends on [email protected]^8.1.0, which differs from the hoisted [email protected]^3.4.0.
lerna WARN EHOIST_PKG_VERSION "n8n-node-dev" package depends on @types/[email protected]^0.1.0, which differs from the hoisted @types/[email protected]^0.2.0.
lerna WARN EHOIST_PKG_VERSION "n8n-node-dev" package depends on [email protected]^2.0.2, which differs from the hoisted [email protected]^3.0.2.
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna ERR! npm install exited 1 in 'n8n'
lerna ERR! npm install stderr:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   [email protected]"^6.8.0" from the root project
npm ERR!   peer [email protected]">=6.2.2" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     @vue/[email protected]"^5.0.1" from the root project
npm ERR!   2 more (eslint-plugin-import, eslint-plugin-node)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer [email protected]"^7.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-promise
npm ERR!   peer [email protected]">= 4.2.1" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\simon\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\simon\AppData\Local\npm-cache\_logs\2021-04-24T21_05_26_179Z-debug.log
lerna ERR! npm install exited 1 in 'n8n'
PS E:\ordinateur\n8n node\n8n> lerna bootstrap --hoist
lerna notice cli v4.0.0
lerna info versioning independent
lerna info Bootstrapping 6 packages
lerna WARN EHOIST_PKG_VERSION "n8n" package depends on @types/[email protected], which differs from the hoisted @types/[email protected]^14.14.40.
lerna WARN EHOIST_PKG_VERSION "n8n-editor-ui" package depends on [email protected]^8.1.0, which differs from the hoisted [email protected]^3.4.0.
lerna WARN EHOIST_PKG_VERSION "n8n-node-dev" package depends on @types/[email protected]^0.1.0, which differs from the hoisted @types/[email protected]^0.2.0.
lerna WARN EHOIST_PKG_VERSION "n8n-node-dev" package depends on [email protected]^2.0.2, which differs from the hoisted [email protected]^3.0.2.
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna ERR! npm install exited 1 in 'n8n'
lerna ERR! npm install stderr:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   [email protected]"^6.8.0" from the root project
npm ERR!   peer [email protected]">=6.2.2" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     @vue/[email protected]"^5.0.1" from the root project
npm ERR!   2 more (eslint-plugin-import, eslint-plugin-node)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer [email protected]"^7.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-promise
npm ERR!   peer [email protected]">= 4.2.1" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\simon\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\simon\AppData\Local\npm-cache\_logs\2021-04-24T21_09_15_123Z-debug.log
lerna ERR! npm install exited 1 in 'n8n'
PS E:\ordinateur\n8n node\n8n> npm run build

> build
> lerna exec npm run build

lerna notice cli v4.0.0
lerna info versioning independent
lerna info Executing command in 6 packages: "npm run build"

> [email protected] build
> tsc


> [email protected] build
> tsc

error TS2688: Cannot find type definition file for 'node'.
  The file is in the program because:
    Entry point of type library 'node' specified in compilerOptions

  tsconfig.json:7:4
    7    "node"
         ~~~~~~
    File is entry point of type library specified here.


Found 1 error.

lerna ERR! npm run build exited 2 in 'n8n-node-dev'
lerna ERR! npm run build exited 2 in 'n8n-node-dev'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
PS E:\ordinateur\n8n node\n8n> error TS2688: Cannot find type definition file for 'jest'.
  The file is in the program because:
    Entry point of type library 'jest' specified in compilerOptions

  tsconfig.json:9:4
    9    "jest"
         ~~~~~~
    File is entry point of type library specified here.

error TS2688: Cannot find type definition file for 'node'.
    Entry point of type library 'node' specified in compilerOptions

  tsconfig.json:8:4
    8    "node",
         ~~~~~~
    File is entry point of type library specified here.


Found 2 errors.

                               npm run start

> start
> run-script-os

'run-script-os' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
PS E:\ordinateur\n8n node\n8n>

package.json:
{

  "name": "n8n",

  "private": true,

  "homepage": "https://n8n.io",

  "scripts": {

    "bootstrap": "lerna bootstrap --hoist --no-ci",

    "build": "lerna exec npm run build",

    "dev": "lerna exec npm run dev --parallel",

    "clean:dist": "lerna exec -- rimraf ./dist",

    "optimize-svg": "find ./packages -name '*.svg' -print0 | xargs -0 -P16 -L20 npx svgo",

    "start": "run-script-os",

    "start:default": "cd packages/cli/bin && ./n8n",

    "start:windows": "cd packages/cli/bin && n8n",

    "test": "lerna run test",

    "tslint": "lerna exec npm run tslint",

    "serve": "env VUE_APP_URL_BASE_API=http://localhost:5678/ vue-cli-service serve",

    "watch": "lerna run --parallel watch"

  },

  "devDependencies": {

    "lerna": "^3.13.1",

    "rimraf": "^3.0.2",

    "run-script-os": "^1.0.7"

  },

  "postcss": {},

  "dependencies": {

    "@typescript-eslint/parser": "^4.22.0"

  }

}

I have partially solved different errors by downloading other packages

Lerna manages packages for n8n - no packages need to be individually downloaded.

Just tested the command with PS on a new clone and it succeeded:

PS C:\Users\ivov\Desktop\n8n> lerna bootstrap --hoist
lerna notice cli v3.22.0
lerna info versioning independent
lerna info Bootstrapping 6 packages
lerna WARN EHOIST_PKG_VERSION "n8n" package depends on @types/[email protected], which dif
14.14.40.
lerna WARN EHOIST_PKG_VERSION "n8n-editor-ui" package depends on [email protected]^8.1.0, which d
.
lerna WARN EHOIST_PKG_VERSION "n8n-node-dev" package depends on @types/[email protected]^0.1.0, wh
/[email protected]^0.2.0.
lerna WARN EHOIST_PKG_VERSION "n8n-node-dev" package depends on [email protected]^2.0.2, w
[email protected]^3.0.2.
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna info hoist Finished bootstrapping root
lerna info Symlinking packages and binaries
lerna success Bootstrapped 6 packages

Is lerna bootstrap --hoist failing on a new clone?

If not, please make a new clone and run lerna bootstrap --hoist on it.

If yes, please run lerna clean and then lerna bootstrap --hoist.

2 Likes

Here is the main error that comes back for the “npm run build” command line

npm run build exited 2 in 'n8n-editor-ui'

Using your “clean” command I have the same problem as before.

image

It’s ok, I solved the problem by reinstalling node js. I can make the tool work. Thanks again for helping me. In the next day I will share my node creation.

npm 7 introduced a breaking change blocking package installation when there is a dependency conflict.

Please set this flag:

npm config set legacy-peer-deps true

And re-run the commands starting from lerna bootstrap --hoist

5 Likes