Invalid module ".prisma" error during Nitro build with Prisma client (Windows only)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Environment
- Nitro version: 2.11.12 (based on error logs)
- Node.js version: v22.11.0
- Package manager: pnpm
- Prisma client version: 6.8.2
- OS: Windows
Reproduction
The issue occurs when building any Nitro project with:
- Prisma client integration
- pnpm as package manager
- Windows environment (issue does not occur on Linux/macOS)
Error happens during the Nitro build process regardless of preset (tested with both aws-lambda and node-server presets).
Describe the bug
When building a Nitro project that uses Prisma client on Windows, the build fails with:
ERROR TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ".prisma" is not a valid package name
The error occurs in the module resolution phase during the Rollup bundling process. This is a general build issue that affects all presets, not specific to aws-lambda. The issue seems to be related to how Nitro/Rollup handles the Prisma client's internal module structure on Windows systems, specifically the .prisma generated client.
Additional deprecation warning appears:
DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution
Additional context
- Using pnpm workspace setup
- Issue affects all build presets (
node-server,aws-lambda, etc.) - Issue appears to be Windows-specific - same setup works on Linux/macOS
- Likely related to Windows path handling (D: paths vs
/paths) - Issue occurs during Rollup's module resolution process
Logs
[nitro 11:08:17 a. m.] ✔ Generated public .output/public
[nitro 11:08:18 a. m.] ℹ Building Nitro Server (preset: node-server, compatibility date: 2024-10-15)
(node:13768) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at D:\work\movify\web-quote-api\apps\lead-api\node_modules\@prisma\client\package.json imported from D:\work\movify\web-quote-api\apps\lead-api\clients\db.provider.client.ts. Mapping specifiers ending in "/" is no longer supported.
[nitro 11:08:28 a. m.] ERROR TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ".prisma" is not a valid package name imported from D:\work\movify\web-quote-api\node_modules\.pnpm\@prisma+client@6.8.2_prisma@6.8.2_typescript@5.8.3__typescript@5.8.3\node_modules\@prisma\client\default.js
[11:08:28 a. m.] ERROR Invalid module ".prisma" is not a valid package name
at __node_internal_ (/D:/work/movify/web-quote-api/node_modules/.pnpm/exsolve@1.0.5/node_modules/exsolve/dist/index.mjs:159:9)
at new NodeError (/D:/work/movify/web-quote-api/node_modules/.pnpm/exsolve@1.0.5/node_modules/exsolve/dist/index.mjs:130:5)
at parsePackageName (/D:/work/movify/web-quote-api/node_modules/.pnpm/exsolve@1.0.5/node_modules/exsolve/dist/index.mjs:1097:11)
[... full stack trace as provided]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing a Nitro build on Windows with the Prisma client, pnpm, and either the node-server or aws-lambda preset. Read clients/db.provider.client.ts, @prisma/client/default.js, and the exsolve stack location shown in the logs; done means the build completes without the invalid ".prisma" module error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100