Unable to update n8n running via npm and pm2 v1.105.3

Describe the problem/error/question

I am trying to update n8n self-hosted via npm. Running npm update -g n8n gives me this;

npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @n8n/[email protected]
npm warn Found: @sentry/[email protected]
npm warn node_modules/n8n/node_modules/@sentry/node
npm warn   @sentry/node@"^9.42.1" from [email protected]
npm warn   node_modules/n8n
npm warn     n8n@"*" from the root project
npm warn   3 more (n8n-core, @n8n/task-runner, @sentry/node-native)
npm warn
npm warn Could not resolve dependency:
npm warn peerOptional @sentry/node@"<=8.x" from @n8n/[email protected]
npm warn node_modules/n8n/node_modules/@n8n/typeorm
npm warn   @n8n/typeorm@"0.3.20-12" from [email protected]
npm warn   node_modules/n8n
npm warn   3 more (@n8n/backend-test-utils, @n8n/db, @n8n/n8n-nodes-langchain)
npm warn
npm warn Conflicting peer dependency: @sentry/[email protected]
npm warn node_modules/@sentry/node
npm warn   peerOptional @sentry/node@"<=8.x" from @n8n/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/typeorm
npm warn     @n8n/typeorm@"0.3.20-12" from [email protected]
npm warn     node_modules/n8n
npm warn     3 more (@n8n/backend-test-utils, @n8n/db, @n8n/n8n-nodes-langchain)
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @browserbasehq/[email protected]
npm warn Found: [email protected]
npm warn node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/openai
npm warn   openai@"5.8.1" from @n8n/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain
npm warn     @n8n/n8n-nodes-langchain@"1.106.2" from [email protected]
npm warn     node_modules/n8n
npm warn   1 more (@langchain/community)
npm warn
npm warn Could not resolve dependency:
npm warn peer openai@"^4.62.1" from @browserbasehq/[email protected]
npm warn node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/@browserbasehq/stagehand
npm warn   peer @browserbasehq/stagehand@"^1.0.0" from @langchain/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/@langchain/community
npm warn
npm warn Conflicting peer dependency: [email protected]
npm warn node_modules/openai
npm warn   peer openai@"^4.62.1" from @browserbasehq/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/@browserbasehq/stagehand
npm warn     peer @browserbasehq/stagehand@"^1.0.0" from @langchain/[email protected]
npm warn     node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/@langchain/community
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @langchain/[email protected]
npm warn Found: [email protected]
npm warn node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/mongodb
npm warn   mongodb@"6.11.0" from @n8n/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain
npm warn     @n8n/n8n-nodes-langchain@"1.106.2" from [email protected]
npm warn     node_modules/n8n
npm warn
npm warn Could not resolve dependency:
npm warn peerOptional mongodb@"^6.17.0" from @langchain/[email protected]
npm warn node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/@langchain/community
npm warn   @langchain/community@"0.3.47" from @n8n/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain
npm warn
npm warn Conflicting peer dependency: [email protected]
npm warn node_modules/mongodb
npm warn   peerOptional mongodb@"^6.17.0" from @langchain/[email protected]
npm warn   node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/node_modules/@langchain/community
npm warn     @langchain/community@"0.3.47" from @n8n/[email protected]
npm warn     node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain

removed 34 packages, and changed 2 packages in 12s

244 packages are looking for funding
  run `npm fund` for details

After the above, still stuck on 1.105.3. I tried all kinds of things like running the install command, uninstalling and reinstalling, nothing appears to work.

What is the error message (if any)?

none

Please share your workflow

n/a

Share the output returned by the last node

n/a

Information on your n8n setup

  • n8n version: 1.105.3
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu 22.04

Running ‘n8n –version’ shows 1.105.3 regardless of my update attempts

Managed to get it updated by completely uninstalling and removing all traces of n8n from the system. Reinstalled it and confirmed that it is now on latest.

New issue now, getting the below when navigating to :5678;

Cannot GET /

The culprit was this log;

Error: Cannot find module ‘ajv/dist/core’

Complete reinstall again and managed to get it back up and running again.

There HAS to be a better way to handle updates…

I had the same issue with updating our self-hosted n8n instance.

Probably not the ideal fix but I found running npm config set legacy-peer-deps true prior to the upgrade resolved the peer dependency errors

Guys, I was having the same problem.
I think it was stemming from the npm running the wrong/old version existing in my system for some reason.
I asked it to one of the LLMs, and it said:

1. Use npx

The most straightforward method is to prefix your command with npx. This tool automatically finds and runs the command from your project’s local node_modules directory.

Bash

npx n8n start

This is the recommended way to run locally installed packages without having to worry about your system’s PATH.

which seems to work for me!

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