Can't link sample custom node to n8n

Describe the problem/error/question

I am following the guide on how to create a custom node [here].(https://docs.n8n.io/integrations/creating-nodes/build/programmatic-style-node/#test-your-node)

I’ve searched for similar questions and i found this one here

I followed the guide to create a custom node, In the final step when I run
inside my ~/.n8n/custom

# In the nodes directory within your n8n installation
# node-package-name is the name from the package.json
npm link n8n-nodes-friendgrid

and then

n8n start

I cannot see my node in the nodes list.

Similarly I followed the video in the question above video here and ran inside my
/usr/local/lib/node_modules/n8n

# In the nodes directory within your n8n installation
# node-package-name is the name from the package.json
npm link n8n-nodes-example

still can’t see sample nodes inside n8n node list.

Note:

I can see my n8n global installation + my n8n-nodes-example link when i type:
npm list -g

what am i missing ? what could I’ve done wrong ? I made sure i followed the steps exactly as instructed.
Thanks!

Information on your n8n setup

  • n8n version:1.27.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via :n8n
  • Operating system:macOS ventura 13.0.1

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 @abdelrahman,

Welcome to the community :cake:

When you run the npm link command in the ~/.n8n/custom directory does it show any errors and does it show the files are linked?

When you then run n8n start does that show any errors?

1 Like

Initially it showed me an access denied error.

i then proceeded to run the command using:

sudo npm link n8n-nodes-example

then it shows me 1 package added , if i run it again it shows this:

You shouldn’t see an access denied message :thinking: It sounds like something is odd with the setup. When you start n8n do you also use sudo?

No i don’t, although when i neended to install it globaly, I faced an access denied and used:

sudo npm install n8n -g

Does your user own the .n8n/custom folder?

When you start n8n does it show any errors?

1 Like

I solved the issue.

what i did:

  1. removed my old installation of node and npm.
  2. reinstalled node and npm.
  3. tried the
    npm install n8n -g
    when it threw an EACCESS error I changed the owner of my ~/.npm and /usr/local/lib/node_modules according to this stackoverflow question here.
  4. followed the tutorial again and didn’t face any EACCESS issues while installing n8n globally or while using npm link.
  5. I can see the custom nodes in n8n node list.
1 Like

I have the same problem (but I don’t have access denied, my user owns the .n8n), I’m following the tutorial of the documentation but it doesn’t show the custom node created:

my n8n intalation:

  • node version: 18.19.0
  • n8n version: 1.29.1
  • Running n8n via: npm
  • Operating system: ubuntu 20.04

Note:

I’m using nvm to manage the nodejs versions.

n8n instalation path:

Hey @jomitame,

Are you running the link command in the correct folder? It would be handy if you could share the exact commands you are running and the directories you are running them in as it appears to be working for me at the moment on MacOS and Ubuntu.

Hi @Jon thanks for answer.

I think I’m running the link command in the correct folder, according to the documentation, I mean, I do this:

My n8n instalation is located in:

/home/jomitame/.nvm/versions/node/v18.19.0/lib/node_modules/n8n

then according to the documentation I did:

cd /home/jomitame/.nvm/versions/node/v18.19.0/lib/node_modules/n8n
mkdir custom
cd custom
npm init
npm link n8n-nodes-nasapics
n8n start

the custom node didn’t show, then I made:

cd /home/jomitame/.nvm/versions/node/v18.19.0/lib/node_modules/n8n
mkdir nodes
cd nodes
npm init
npm link n8n-nodes-nasapics
n8n start

that neither works.

Like I said I think I’m doing right but, please let me know if I making any mistake.

Also I tried to follow the tutorial for a programmatic-style node, but neither the custom node didn’t shows.

Then I tried to follow the Marco’s tutorial video, but I think in the n8n version 1.29.1 it doesn’t work.

I really apreciate if you can teach me the steps for get a success custom node.

Hey @jomitame,

That is the wrong path, I will update the docs to make that clearer as it looks like you are not using ~/.n8n/custom/ which is the path we would expect which would actually be /home/jomitame/.n8n/custom

Can you try using that path instead, You also don’t need to run the npm init command.

mkdir -p ~/.n8n/custom
cd ~/.n8n/custom
npm link n8n-nodes-nasapics
n8n start
1 Like

Hi @Jon

About you told me, I understand that it doesn’t mater where the n8n is installed when I run:

npm install n8n -g

always the correct path for link the node is:

~/.n8n/custom

Is that rigth ??

Hey @jomitame,

Yeah you got it, So n8n will always look under ~/.n8n for its config and database unless you change this with an env option but we will assume you are not doing that :slight_smile:

Hi @Jon sorry for bother you, but I got an error.

What I’m doing wrong :disappointed_relieved: ?

Not too sure there, Looks like azure package is causing issues I take it you have not changed the code in the node?

HI @Jon thanks for answer.

Nop I didn’t any change in azure node, I only did the changes explained in the documentation for create the nasapics custom node.

The error say something about using import sentence outside a module, but this error is new for me, I haven’t see it before, doing the custom node.

I suspect it could be another issue with npm packages, What version of n8n are you running? It may be worth running it in a container which results in less of these issues.

Hi @Jon

I’m running n8n version 1.29.1.

I will try to work in a docker.

Does the custom node creation tutorial work to run it within a docker?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.