N8n-nodes-starter example switched to pnpm, does not match tutorial

Hi!

It looks like back in July 2024 (over 4 months ago), n8n-nodes-starter changed from using npm to only use pnpm in order to match the package manager that n8n uses (PR#41). However, the Build a declarative style node tutorial has not been updated to reflect this change. This has led to a lot of frustration and grief trying to follow the tutorial to make a custom node work.

  • The tutorial says to run npm i, which produces a use "pnpm install" message.
  • pnpm install appears to work
  • npm run build and pnpm run build both do not work
  • npm link and pnpm link both do not work
  • npm link <node-package-name> and pnpm link <node-package-name> both do not work

Can you please let me know how I can make the n8n-nodes-starter code work with the new pnpm change?

n8n version: 1.64
Database: SQLite
n8n EXECUTIONS_PROCESS setting: own, main
Running n8n via: npm
Operating system: MacOS Sequoia

1 Like

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:

I ended up reverting back to an old version of package.json that uses npm instead of pnpm. I can get the custom node to work this way. It would still be nice to get some guidance on how to make it work with pnpm if this is n8n’s package manager of choice moving forward.

Another option is to skip the link stuff and use Docker.

Writeup here: Developing Custom Nodes for n8n with Docker - DEV Community

1 Like

Thanks @hubschrauber , this was helpful.

Faced same issue with pnpm, after tinkering and tbh lots of chatgpt discusstions about pnpm vs npm “link”. It worked.

I’m not sure what exactly worked, but this what worked:

  • installed n8n globally using nvm (had issues with homebrew “–global” files location)
  • in /.n8n/custom, edited package.json (got after pnpm init) with this:
  "dependencies": {
    "n8n-nodes-fireflyiii": "file:/Users/{YOUR-USER}/n8n-fireflyiii-node"
  },
  • Key is package name, one you made pnpm link with, and file path is folder location of your node.

So now, i just:

  • pnpm run build in node directory
  • pnpm install in ~/.n8n/custom directory
  • n8n → to run

Every time wanna test the node.

Also, not related to the topic, but https://webhook.site/ made my life easier! in my local n8n, having two credentials one with base url of the real service i’m building for, the other one has base url from that website. Switching between them in testing to see the actual URL called by n8n.
Note; made custom base-url variable in credentials, and uses that in calls.