Prisma Nuxt RollupError
Hello, I am trying to use @prisma/nuxt, but after installation and when I run
Does anyone have any ideas?
npm run dev
, it results in the error ℹ Vite server warmed up in 3864ms 9:33:51 AM
ℹ Vite client warmed up in 5284ms 9:33:52 AM
[9:33:52 AM] WARN [plugin inject] node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected]_@[email protected]_2uyq5cr4225ns57lx4llpfiydq/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse /home/joe/novaint/node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected]_@[email protected]_2uyq5cr4225ns57lx4llpfiydq/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include
[nitro 9:33:52 AM] ERROR RollupError: node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected]_@[email protected]_2uyq5cr4225ns57lx4llpfiydq/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts (2:8): Expected ';', '}' or <eof> (Note that you need plugins to import files that are not JavaScript)
1: import { PrismaClient } from "@prisma/client";
2: declare const prismaClientSingleton: () => PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, i...
^
3: declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client...
4: export type CustomPrismaClient = ReturnType<typeof prismaClientSingleton>;
✔ Nuxt Nitro server built in 2407 ms
ℹ Vite server warmed up in 3864ms 9:33:51 AM
ℹ Vite client warmed up in 5284ms 9:33:52 AM
[9:33:52 AM] WARN [plugin inject] node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected]_@[email protected]_2uyq5cr4225ns57lx4llpfiydq/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse /home/joe/novaint/node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected]_@[email protected]_2uyq5cr4225ns57lx4llpfiydq/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include
[nitro 9:33:52 AM] ERROR RollupError: node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected]_@[email protected]_2uyq5cr4225ns57lx4llpfiydq/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts (2:8): Expected ';', '}' or <eof> (Note that you need plugins to import files that are not JavaScript)
1: import { PrismaClient } from "@prisma/client";
2: declare const prismaClientSingleton: () => PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, i...
^
3: declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client...
4: export type CustomPrismaClient = ReturnType<typeof prismaClientSingleton>;
✔ Nuxt Nitro server built in 2407 ms
6 Replies
Hi @johnk 👋
Can you try swapping
pnpm
for npm
and see if you get the same error?Hello, same error with npm. Slightly different.
ℹ Vite server warmed up in 5669ms 10:18:50 PM
ℹ Vite client warmed up in 6205ms 10:18:50 PM
[10:18:50 PM] WARN [plugin inject] node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse /home/joe/novaint/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include
[nitro 10:18:50 PM] ERROR RollupError: node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts (2:8): Expected ';', '}' or <eof> (Note that you need plugins to import files that are not JavaScript)
1: import { PrismaClient } from "@prisma/client";
2: declare const prismaClientSingleton: () => PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, i...
^
3: declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client...
4: export type CustomPrismaClient = ReturnType<typeof prismaClientSingleton>;
✔ Nuxt Nitro server built in 546 ms
ℹ Vite server warmed up in 5669ms 10:18:50 PM
ℹ Vite client warmed up in 6205ms 10:18:50 PM
[10:18:50 PM] WARN [plugin inject] node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse /home/joe/novaint/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include
[nitro 10:18:50 PM] ERROR RollupError: node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts (2:8): Expected ';', '}' or <eof> (Note that you need plugins to import files that are not JavaScript)
1: import { PrismaClient } from "@prisma/client";
2: declare const prismaClientSingleton: () => PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, i...
^
3: declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client...
4: export type CustomPrismaClient = ReturnType<typeof prismaClientSingleton>;
✔ Nuxt Nitro server built in 546 ms
Hey there @johnk ,
Can you provide some steps to reproduce the error?
- What version of Nuxt are you running?
- Is it a fresh project or is there any custom config?
- What version of NodeJs are you using?
That'll help us debug the issue better 🙂 .
I can run it, but I can't build it, it will cause errors.
Hey @yinxingmaiming6409 , do you have a small reproduction of the issue? That'll help me identify what the issue maybe.
Many people have already reacted on GitHub, right.