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.

1 Like

I saw that @Benwhut made a Youtube video on the workaround, but any way to actually do this without a “workaround”?

Still hoping for a solution here. The N8N team has mentioned they’re working on a way to allow Cloud users to access community nodes, so I’m assuming they’re going to revamp the whole process rather than updating the documentation with pnpm compatibility. Hoping that comes soon!

Hey there,

I created a post that deals with it.

You’ll find a Github repository that make custom nodes work in a devcontainer. If you want to use it locally, just give a look at the .devcontainer file and search for the initialisation scripts.

Basically, it just involves launching n8n to create ~/.n8n and then creating ~/.n8n/custom directory and then running pnpm link PATH_TO_CUSTOM_NODE inside it so that n8n knows it exists.

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