Cannot run custom node locally from nodes folder

Describe the problem/error/question

I installed my custom node locally in my instance of n8n running locally. There was no ~/.n8n/nodes directory when I started but I created it (but there was an ~/.n8n) directory. I followed the instructions for using npm link and have the package linked in the ~/.n8n/nodes directory (which created a node_modules directory after the link.

But no matter what I try the custom node does not show up. I am just using the generic n8n starter and haven’t made any changes to it yet, just trying to create the dev workflow.

I have searched for the node by the node name not the package name (Example)

Any help would be greatly appreciated. I’ve been hacking at this for a while now and haven’t made any progress at all.

What is the error message (if any)?

No error message, just my node does show up.

Information on your n8n setup

  • n8n version:: 1.01
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): pnpm run dev
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Locally from git clone
  • Operating system: Mac OSX Ventura 13.4.1

Hey @zenweasel,

I did the same process last week for a node I was working on and it seemed to work ok for me, After you ran npm link n8n-nodes-your-package in the nodes directory did you then restart n8n?

Yes. It worked when I added the package to the custom directory rather than the nodes directory. So something seems to be broken with the underlying implementation

Hey @zenweasel,

That is odd, I was using the nodes directory so for me it was working ok. I wonder if there was an error with the node or something, If you clear our the nodes directory and try again does it start working?

I’ve tried just about every combination. It doesn’t create a nodes directory and when I created it, it does not seem to use it. I have installed, uninstalled n8n every which way and finally am running it locally from a clone. Any of those ways the behavior is the same, no nodes directory is created and if I create one it is ignored. The home directory it is using is ~/$HOME/.n8n

The validation that my node works fine is that it shows up in the Nodes options and I can use it in workflows when installed into custom.

Right now it’s working for me when using custom and this is only for local development of custom nodes so I have what I need for now.

1 Like

Hey @zenweasel,

That is somewhat worrying but as you have something that works I will do some more digging internally to see if I can find something.

Let me know if I can help in any way

Hey @Jon , I’m running into the same issue here. I tried linking a custom node to the ~/.n8n/custom directory and it’s not working when I run n8n locally. This is using [email protected] – is this a known bug?

1 Like

@dkindlund I just did this a few days ago on the same patch and it worked for me.

Make sure you link your node with just npm link from the node directory and then link from the custom folder in the local directory with npm link n8n-nodes-your-package-name

Make sure you’re linking to local n8n and not the one in the npm package directory.

Also, you need to stop and start n8n to see it.
Hope that helps.

edit: now that im thinking again, i think i had to trouble shoot an issue where i had a typed in the file name or package.json or something that was causing it not to show up. I can’t really remember, but try to link a fresh install of the starter custom node and see if you have luck with that

1 Like

Hey @liam , thanks for the sanity check. I tried your steps again, and I was able to get it working. I think there’s some sort of fundamental browser caching issue that was causing me issues initially.

1 Like

Glad to hear you got it working :+1:

1 Like

I moved my nodes from .n8n/custom to .n8n/nodes and it works much better post v1.0.

Also noticed using nodes in the custom dir screws up the node references, so you can’t easily fork and swap between it and a community node

1 Like

I was getting no nodes loaded from the custom directory. Changing it to the nodes directory resulted in the nodes getting loaded. Instructions right now on the tutorial page are a little vague. They mention a “nodes” directory but it wasn’t clear to me that this was a specific directory name.

I suggest adding a specific bullet point for ~/.n8n/nodes/ and providing more information about what these different directories mean. Is there a default? Is there a purpose to using different directories?