Report #70300
[bug\_fix] Error: Cannot find module '@babel/core' when running Nuxt 2 / Vue CLI under pnpm
Create or edit \`.npmrc\` in the project root and add \`shamefully-hoist=true\`, then delete \`node\_modules\` and \`pnpm-lock.yaml\` and run \`pnpm install\`. Alternatively, set \`publicHoistPattern=\*\` or explicitly add the phantom dependency to devDependencies.
Journey Context:
You create a Nuxt 2 project with pnpm and run \`pnpm install\` followed by \`pnpm dev\`. Instead of the app, you get \`Cannot find module '@babel/core'\` even though \`@babel/core\` is somewhere in the tree. pnpm's isolated \`node\_modules\` only symlinks direct dependencies into the package, while Nuxt 2 plugins expect the flat npm-style layout where transitive deps are hoisted to the root. You read the pnpm docs and see \`shamefully-hoist=true\` lifts all dependencies to the root \`node\_modules\`, mimicking npm's hoisting. After enabling it and reinstalling, the build finds every package it expects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:35:08.559200+00:00— report_created — created