Linking n8n-nodes-starter into n8n

I followed the instruction here: Build a node - n8n Documentation

Now the node is linked: C:\Users\axelr\Documents\n8n\n8n\node_modules\n8n-nodes-shopware → C:\Users\axelr\AppData\Roaming\npm\node_modules\n8n-nodes-shopware → C:\Users\axelr\Documents\n8n\Shopware

I also updated the package.jsonto the correct name and ran a build. But I can’t see it getting loaded.

I checked the code from LoadNodesAndCredentialsClass but I can’t find the part where the global linked packages are loaded. The only folder checked is \packages\cli\node_modules\

When I link my node to into the cli-package it is getting loaded. Or does “npm run start” does not do the trick and I have to use “n8n” for start?

I removed the link from the cli package and starting via “npx n8n” does still not include the link.

So currently n8n and also your custom node-package are installed globally? That should theoretically work but to be honest, never tested that. What the code does is that it looks for packages that are installed alongside n8n. So if both are global that should be the case. But like I said never tested that specifically.
I advise you to “install” n8n in a folder and also your custom package alongside it. It should then work. At least if it has the nodes correctly set in the package.json file and the package name starts with n8n-nodes-.

I have only the new node installed globally - this is what node-link does, isn’t it?

To be fair, I am not that experienced with node.js and npm and as an addition to this I am working with windows. I am not sure how I come around to have the “n8n” command. At the moment I start n8n with ./packages/cli/bin/n8n start.

I have the same problem.
I tried to follow the documentation with this script:

#!/bin/bash
git clone [email protected]:n8n-io/n8n-nodes-starter.git
cd n8n-nodes-starter
npm install 
npm run build
npm link
npm link n8n-nodes-starter
n8n

But I can’t see the node listed.
The result of npm list is

[email protected] /tmp/n8n-nodes-starter
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] -> /tmp/n8n-nodes-starter
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I don’t know what I’m missing

Welcome to the community @VincentL!

Did you and @Axel try what I wrote? Like I said never tested with n8n globally installed in combination with custom modules.

Thank you for the welcome!

I got it working following your advice:

#!/bin/bash
git clone [email protected]:n8n-io/n8n-nodes-starter.git
cd n8n-nodes-starter
npm install
npm run build
npm link
cd ..
mkdir n8n_install
cd n8n_install
npm init
npm install
npm install n8n
npm link n8n-nodes-starter
npx n8n

But my aim was so install it in the docker image, but it seems difficult with this method, I’ll use the custom directory

1 Like

Glad to hear that you got it working!

Yes, agree with Docker it would really be great if it would work globally as you could so simply extend the existing n8n image. Hope I find some time the next days to test.

I investigated a bit what was the problem.
I think here n8n/LoadNodesAndCredentials.ts at master · n8n-io/n8n · GitHub
You can look for pathes of module.paths
But in the following part of the function you are just looking for module in one path, and unfortunately the module is not in the first path.
My experience in JS is very limited, I hope this comment can help to investigate the issue

Did you ever find a good workflow for testing this and having it work across deployments: n8n cloud, n8n docker, n8n local? (I’m using Yarn 3.x, not npm)

Perhaps a Dockerfile might be a nicer way to make this easy to test?

Hey @haf,

A lot has changed in 2 years so it might be worth opening a new post for this. We have created our starter template to use npm but if you want to just test your workflows you can load them into n8n by setting N8N_CUSTOM_EXTENSIONS to the path that contains your dist folder then restart n8n and your node should appear.