Custom node dev issue

Hi all.
Building my first custom node (following this: Creating your first node | Docs), but facing an issue in the beginning itself.

After configuring the basic node files and running commands upto npm run dev, i’ve opened the browser at localhost:8080.

The issue: can’t see my newly declared node in the Nodes list!

How to debug this?

Also gone through the Troubleshooting docs (Troubleshooting | Docs)

That usually happens when the node it’s not registered in packages/nodes-base/package.json or the node’s name it’s misspelled.

So to be sure, you do not see any errors?

Also, did you run the commands lerna, etc in the order listed in the tutorial?

@RicardoE105
Checked the package.json entry already.

And no errors seen.

My steps:

lerna clean
lerna bootstrap --hoist
npm run build
npm run dev

The UI opens up at localhost:8080 but the newly created node isn’t available in the list.

My env:

  • Windows 10
  • node 14.17.4
  • npm 7.13.0

Update:
I also tried this in an Ubuntu 20.04 machine. Same result.

Also, is it necessary that another instance of local n8n (npm/docker) already be up and running for the dev operation (including the UI at port 8080) to work?

Because, otherwise, my UI at 8080 doesn’t even work and i wasn’t expecting that. Error:

There was a problem loading init data:
API-Server can not be reached. It is probably down.

Env:
Windows 10/Ubuntu 20.04

Hey Shrey,

Also, is it necessary that another instance of local n8n (npm/docker) already be up and running for the dev operation (including the UI at port 8080) to work?

You don’t need to have a separate instance running locally. Once you add the necessary code and reference the node in package.json, you need to run the commands you shared earlier.

Do you have your code on GitHub? Can you share the link with us?

@harshil1712 Hey Harshil, so far i haven’t really added much custom code.
What i’ve done is-

  • git clone the n8n main repo (https://github.com/n8n-io/n8n.git)
  • add a folder ‘FriendGrid’ (/n8n/packages/nodes-base/nodes/FriendGrid)
  • add "dist/nodes/FriendGrid/FriendGrid.node.js" to n8n.nodes in /n8n/packages/nodes-base/package.json, and then run:
lerna clean
lerna bootstrap --hoist
npm run build
npm run dev

Result:
UI opens up at localhost:8080 but the FriendGrid node is not available in the nodes’ list.

I could send this modified repo to you, if needed.

Hey @shrey-42,

When you say add the Folder ‘FrindGrid’ did you also add the code files in the folder, or is it an empty folder? I just want to make sure that I have the correct information.

If you can send the modified repo, it would be really useful. It will help us figure out the issue faster :slight_smile:

Missed mentioning that, the FriendGrid folder contains the files:

  • friendGrid.svg
  • FriendGrid.node.ts

Sure, np.

Hey @shrey-42,

I ran your code and the node gets displayed for me. After downloading the code you shared, I ran the above commands and navigated to localhost:8080. Not sure if it’s a Window specific issue. Do you get any errors in the terminal during build or dev?

Maybe @ivov has some ideas.

Currently, i’ve been trying this on Ubuntu 20.04 as well, with the same issue.

Maybe there’s an environmental difference between yours (already working for dev stuff, i assume?) and mine (fresh n8n-dev env) ?

Is there any other configuration/setup required besides this: Creating your first node | Docs ?

I am on MacOS using

node - 14.16.1
npm - 6.14.12
lerna - 3.22.1

With regards to the dev environment config, i tried this process with both, root & non-root users, to root out permission issues.

System env:

Ubuntu 20.04

node 14.17.5
npm 7.20.5
lerna 4.0.0

Besides this, i’ll just wait for some suggestion on what else to try.

1 Like

Your node is working for me as well, with npm run dev on localhost:8080.

You can also try running two processes with npm run watch and npm run start and check localhost:5678

Hi @ivov , i tried running npm run start instead of npm run dev and now the custom node is available on localhost:5678.

Also, localhost:8080 is not available anymore.

Does this imply that the issue isn’t too significant and it’s okay to continue developing like this?

Note:
Have achieved the same behaviour on both, Windows 10 & Ubuntu 20.04 environments: custom nodes available via npm run start >> localhost:5678

Working with two processes on 5678 is how I do it normally.

Nodes are loaded when the server inits, so:

  • If you edit node params, you will need to stop and restart with npm run start for your param changes to be reflected.
  • If you edit the contents of the execute() method, there is no need to restart.

In the background, npm run watch should be running to transpile your work.

1 Like