Skip to content

Build your personal knowledge base with Trilium Notes

docs(dev): install pnpm with npm instead of corepack

Elian Doran6a72759ba8b3
diff --git a/CLAUDE.md b/CLAUDE.md
index 20f52b228b..98f2ec2cb5 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -9,7 +9,7 @@ Trilium Notes is a hierarchical note-taking application with synchronization, sc
## Development Commands
```bash
-corepack enable && pnpm install # setup
+npm install -g pnpm && pnpm install # setup (pnpm 12 is a native binary; corepack < 0.34.5 cannot start it)
pnpm server:start # dev server at http://localhost:8080
pnpm desktop:start # Electron dev app
pnpm standalone:start # standalone (in-browser) client
diff --git a/apps/mobile/README.md b/apps/mobile/README.md
index f26765b01e..76feaa40d9 100644
--- a/apps/mobile/README.md
+++ b/apps/mobile/README.md
@@ -6,7 +6,7 @@ Capacitor shell that wraps the [`@triliumnext/standalone`](../standalone/) PWA b
- Android SDK + an emulator or attached device (set up `ANDROID_HOME` / `ANDROID_SDK_ROOT`).
- JDK 17+.
-- The monorepo installed: `corepack enable && pnpm install` at the repo root.
+- The monorepo installed: `npm install -g pnpm && pnpm install` at the repo root.
## First-time setup
diff --git a/docs/Developer Guide/Developer Guide/Environment Setup.md b/docs/Developer Guide/Developer Guide/Environment Setup.md
index c384aadb24..a9b6ee127b 100644
--- a/docs/Developer Guide/Developer Guide/Environment Setup.md
+++ b/docs/Developer Guide/Developer Guide/Environment Setup.md
@@ -1,21 +1,24 @@
# Environment Setup
+## Node.js
+
+Use the Node.js version pinned in `.nvmrc` at the root of the repository. With [nvm](https://github.com/nvm-sh/nvm), `nvm install` run inside the repository installs and activates it.
+
## Setting up `pnpm`
-Trilium uses the `pnpm` package manager in order to better manage its mono-repo structure. Unlike `npm` which comes by default with Node.js, `pnpm` needs to be manually activated.
+Trilium uses the `pnpm` package manager in order to better manage its mono-repo structure. Unlike `npm` which comes by default with Node.js, `pnpm` needs to be installed separately. The expected version is the `packageManager` field of the root `package.json`; a newer release of the same major works too, since `pmOnFail: ignore` in `pnpm-workspace.yaml` tolerates the difference.
-For most systems this can be achieved via `corepack`:
+Install it with `npm`:
```
-corepack enable
+npm install -g pnpm
```
-After that, run `pnpm` in a new terminal to see if it is working. On Windows, if you get:
+pnpm 12 is a native executable that its install script links into place, so the command needs lifecycle scripts allowed (npm's default). Under a version manager such as nvm, a global package belongs to one Node.js version, so run the command again after switching to another one. The [standalone installer](https://pnpm.io/installation) is an alternative that does not depend on the Node.js version.
-```
-pnpm : The term 'pnpm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
-```
+After that, run `pnpm` in a new terminal to see if it is working.
-The solution is to run `corepack enable` in a Terminal with administrative rights.
+> [!WARNING]
+> `corepack enable` is no longer the recommended way to obtain `pnpm`. Only Corepack 0.34.5 or newer (bundled from Node.js 24.12 on) can start the native pnpm 12, and Node.js 25 no longer ships Corepack at all. An older Corepack fails with `Cannot find module '…/corepack/v1/pnpm/12.x.y/bin/pnpm.cjs'`, and the `~/.cache/node/corepack/v1/pnpm/12.x.y` directory it wrote makes a newer Corepack fail the same way, so delete that directory too.
As a quick heads-up of some differences when compared to `npm`:
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 457939d251..33e5a3ef1b 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -8,7 +8,7 @@ nodeLinker: hoisted
# updates and regular installs aren't stalled.
minimumReleaseAge: 0
-# Don't fail when corepack provides a slightly different pnpm version than packageManager declares.
+# Don't fail when the installed pnpm is a slightly different version than packageManager declares.
pmOnFail: ignore
overrides: