I'm trying to use pnpm with lerna to create a monorepo. Unfortunately it all fails when attempting to install lerna itself via pnpm.
Current project structure:
lerna.json contents:
{
"packages": ["functions/*", "libs/*"],
"version": "0.0.0",
"npmClient": "pnpm",
"publish": {
"ignoreChanges": ["ignored-file", "*.md"],
"message": "chore(release): publish",
"registry": "https://npm.pkg.github.com"
},
}
package.json contents:
{
"name": "roci-backend",
"private": true,
"version": "0.0.0"
}
and finally, the pnpm-workspace.yaml:
## include
- "functions/**"
- "libs/**"
pnpm version: 7.0.1
node version: 16.15.0
OS: win 10
Error message:
❯ pnpm add -D -w lerna
ERROR Cannot read properties of undefined (reading 'manifest')
Stack trace:
"stack": "pnpm: Cannot read properties of undefined (reading 'manifest')\n at C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120885:49\n at Array.map (<anonymous>)\n at C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120882:39\n at Array.map (<anonymous>)\n at getImporters (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120878:34)\n at recursive (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120900:31)\n at async handler (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:121294:11)\n at async C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176187:21\n at async run (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176161:34)\n at async runPnpm (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176379:5)"
I have also tried installing many other older versions, as old as 5.xx, but the exact same error persist.
I had a similar problem without Lerna and the easiest solution we found was to install a Linux distro with WSL and run pnpm commands from Linux runtime. I got it working with Windows 10 Pro, Ubuntu 22 WSL version: 1