3

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:

enter image description here

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\\pnpm@7.0.1\\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\\pnpm@7.0.1\\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\\pnpm@7.0.1\\node_modules\\pnpm\\dist\\pnpm.cjs:120878:34)\n    at recursive (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\pnpm@7.0.1\\node_modules\\pnpm\\dist\\pnpm.cjs:120900:31)\n    at async handler (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\pnpm@7.0.1\\node_modules\\pnpm\\dist\\pnpm.cjs:121294:11)\n    at async C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\pnpm@7.0.1\\node_modules\\pnpm\\dist\\pnpm.cjs:176187:21\n    at async run (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\pnpm@7.0.1\\node_modules\\pnpm\\dist\\pnpm.cjs:176161:34)\n    at async runPnpm (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\pnpm@7.0.1\\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.

SebastianG
  • 8,563
  • 8
  • 47
  • 111
  • I can't repro this issue. Is there a stacktrace in the `node_modules/.pnpm-debug.log` file? – Zoltan Kochan May 21 '22 at 00:36
  • @ZoltanKochan thanks for trying to help, I have added the stack trace to the post – SebastianG May 22 '22 at 11:40
  • @ZoltanKochan have you had the chance to look at the log? I have added more details in a github issue I just opened on the subject, including the compiled code throwing it after a clean install: https://github.com/pnpm/pnpm/issues/4904 – SebastianG Jun 20 '22 at 22:39

1 Answers1

0

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