Testing a custom node locally with npm

Describe the issue/error/question

I am new with n8n, and am creating a custom node for some external API requests. I have a custom, programmatically typed node with the following file structure:

package.json --> Root package.json with "n8n" credentials and nodes object
/nodes
    NODENAME.node.ts
    NODENAME.node.json
    NODENAME.png --> logo
/credentials
    NODENAME.credentials.ts
gulpfile.js
tsconfig.json

The file structure gets transpiled to Javascript. But I don’t know how to import this node into ~/.n8n. npm link does not work (?), because the node is a package in a monorepo. Below is the transpiled javascript code:

/nodes
    NODENAME.node.d.ts
    NODENAME.node.js
    NODENAME.node.js.map
    NODENAME.node.json
    NODENAME.png
/credentials
    NODENAME.credentials.d.ts
    NODENAME.credentials.js
    NODENAME.credentials.js.map
package.json

What is the error message (if any)?

The custom node doesn’t show up in the n8n editor. I want to test locally with the npm version of n8n. Does anyone have any tips on how to improve the code / folder structure? And how to import this code inside n8n (with or without using npm link). This code will eventually get used in a production environment inside Docker. Any tips are more than welcome!

Thank you very much.

Information on your n8n setup

  • n8n version: 0.212.1
  • Database you’re using (default: SQLite): SQLITE
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm

Hi there,

Welcome to the community!
This video should help you out. :slight_smile:

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