Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollup error #12

Closed
1034935767 opened this issue Jun 22, 2024 · 28 comments
Closed

rollup error #12

1034935767 opened this issue Jun 22, 2024 · 28 comments
Assignees
Labels
bug Something isn't working released

Comments

@1034935767
Copy link

I got this error, I know auto import by .nuxt\types\nitro-imports.d.ts
const prismaD: typeof import('../../node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d')['default'].
Maybe should not do this
addServerScanDir(createResolver(import.meta.url).resolve("./runtime/server")); at module.ts.

=========================================

[09:20:53]  WARN  [plugin inject] node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse D:/Users/Z/Documents/Workspace/JavaScript/Nuxt/nuxt-demo1/node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include

t)


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>;

============================================

@bbhxwl
Copy link

bbhxwl commented Jun 24, 2024

I can run it, but I cannot build it

@bbhxwl
Copy link

bbhxwl commented Jun 24, 2024

[error] Cannot find module '/drone/src/node_modules/vite/node_modules/rollup/parseAst' imported from /drone/src/node_modules/vite/dist/node/index.js

@mueslirieger
Copy link

mueslirieger commented Jun 26, 2024

I'm also getting this error and I found that it's happening only when I also use the @nuxt/image module. Loading order of modules does not seem to make an impact.
Here would be a minimal reproduction on StackBlitz https://stackblitz.com/edit/nuxt-starter-dybn1q?file=nuxt.config.ts.
Getting Prisma working with Stackblitz made it neccessary for me to use this extension in Chromium based Browsers (personally using Arc).

Are you also using this module? @1034935767 @bbhxwl

@bbhxwl
Copy link

bbhxwl commented Jun 27, 2024

I'm also getting this error and I found that it's happening only when I also use the @nuxt/image module. Loading order of modules does not seem to make an impact. Here would be a minimal reproduction on StackBlitz https://stackblitz.com/edit/nuxt-starter-dybn1q?file=nuxt.config.ts. Getting Prisma working with Stackblitz made it neccessary for me to use this extension in Chromium based Browsers (personally using Arc).

Are you also using this module? @1034935767 @bbhxwl

Indeed, I also have this module because I used @ nuxt/ui pro, which includes these.

@bbhxwl
Copy link

bbhxwl commented Jun 27, 2024

I'm also getting this error and I found that it's happening only when I also use the @nuxt/image module. Loading order of modules does not seem to make an impact. Here would be a minimal reproduction on StackBlitz https://stackblitz.com/edit/nuxt-starter-dybn1q?file=nuxt.config.ts. Getting Prisma working with Stackblitz made it neccessary for me to use this extension in Chromium based Browsers (personally using Arc).

Are you also using this module? @1034935767 @bbhxwl

But there is no problem with the operation, only a compilation error.

@1034935767
Copy link
Author

I think it doesn't matter with other modules. Just should not import prismaD.

@pvlastaridis
Copy link

pvlastaridis commented Jun 27, 2024

I got this error, I know auto import by .nuxt\types\nitro-imports.d.ts const prismaD: typeof import('../../node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d')['default']. Maybe should not do this addServerScanDir(createResolver(import.meta.url).resolve("./runtime/server")); at module.ts.

=========================================

[09:20:53]  WARN  [plugin inject] node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse D:/Users/Z/Documents/Workspace/JavaScript/Nuxt/nuxt-demo1/node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include

t)


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>;

============================================

Well spotted but how can we force it not to export { default as prismaD } from '../../node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d';

@bbhxwl
Copy link

bbhxwl commented Jun 28, 2024

Do you have a solution?

@mueslirieger
Copy link

I find it interesting that the application does work for you when running the dev server but compilation fails because in my project neither of those work @bbhxwl

@bbhxwl
Copy link

bbhxwl commented Jul 1, 2024

I find it interesting that the application does work for you when running the dev server but compilation fails because in my project neither of those work @bbhxwl

Well, yes, it's strange that it can't be officially used, it can only be tested.

@david-walter-naptics
Copy link

I experience the same error message as OP. In a basically empty new project. In my case there is also this behavior where the build fails but the code runs, meaning for example that it did the migrations into my postgresql db. My package.json is the following:

{
    "name": "nuxt-app",
    "private": true,
    "type": "module",
    "scripts": {
        "build": "nuxt build",
        "dev": "nuxt dev --dotenv .env.local",
        "generate": "nuxt generate",
        "preview": "nuxt preview",
        "postinstall": "nuxt prepare",
        "type-check": "npx nuxi typecheck",
        "lint": "eslint .",
        "start": "node .output/server/index.mjs"
    },
    "dependencies": {
        "@nuxt/eslint": "^0.3.13",
        "@nuxt/ui": "^2.17.0",
        "@nuxtjs/i18n": "^8.3.1",
        "@prisma/nuxt": "^0.0.30",
        "@sidebase/nuxt-auth": "^0.7.2",
        "nuxt": "^3.12.2"
    },
    "devDependencies": {
        "@prisma/client": "^5.16.1",
        "prisma": "^5.16.1",
        "typescript": "^5.5.2",
        "vue-tsc": "^2.0.22"
    }
}

I would love to run nuxt-prisma, it is by far the best solution for nuxt and postgresql.

@bbhxwl
Copy link

bbhxwl commented Jul 1, 2024

I experience the same error message as OP. In a basically empty new project. In my case there is also this behavior where the build fails but the code runs, meaning for example that it did the migrations into my postgresql db. My package.json is the following:

{
    "name": "nuxt-app",
    "private": true,
    "type": "module",
    "scripts": {
        "build": "nuxt build",
        "dev": "nuxt dev --dotenv .env.local",
        "generate": "nuxt generate",
        "preview": "nuxt preview",
        "postinstall": "nuxt prepare",
        "type-check": "npx nuxi typecheck",
        "lint": "eslint .",
        "start": "node .output/server/index.mjs"
    },
    "dependencies": {
        "@nuxt/eslint": "^0.3.13",
        "@nuxt/ui": "^2.17.0",
        "@nuxtjs/i18n": "^8.3.1",
        "@prisma/nuxt": "^0.0.30",
        "@sidebase/nuxt-auth": "^0.7.2",
        "nuxt": "^3.12.2"
    },
    "devDependencies": {
        "@prisma/client": "^5.16.1",
        "prisma": "^5.16.1",
        "typescript": "^5.5.2",
        "vue-tsc": "^2.0.22"
    }
}

I would love to run nuxt-prisma, it is by far the best solution for nuxt and postgresql.

I also really want to use it, but unfortunately, let's wait for more people to discover this issue.

@sahibalejandro
Copy link

sahibalejandro commented Jul 7, 2024

I'm facing a similar issue, when adding ONLY the @prisma/nuxt module to nuxt.config.ts it works fine, however as soon as I add the @sidebase/nuxt-auth module to nuxt.config.js I get this error when running npm run dev:

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>;

Code compilation fails but some how the Nuxt development server runs, I guess it silently fails.

I've tried removing node_modules and package-lock.json and reinstall with npm install but nothing changes. I've also tried to change the order of the modules in nuxt.config.ts but the error persists.

It seems like the @nuxt/image module is not the only one affecting @prisma/nuxt, and could be more.

So far I don't have any other clue on what's causing this.

Here is my package.json

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@prisma/nuxt": "^0.0.30",
    "@sidebase/nuxt-auth": "^0.8.0",
    "nuxt": "^3.12.3",
    "vue": "latest"
  },
  "devDependencies": {
    "@prisma/client": "^5.16.1",
    "prisma": "^5.16.1"
  }
}

@ElliottZhao
Copy link
Contributor

I don't understand what's causing this problem, but I noticed in the source code that there's a comment that mentions automatically import the utils directory, but it's implemented as scaning directory. So I made a change here and miraculously it no longer prompts the prisma.d.ts exception on my own computer.
I submitted the RP, can someone please help me see if it didn't introduce additional issues?

@sahibalejandro
Copy link

sahibalejandro commented Jul 9, 2024

I don't understand what's causing this problem, but I noticed in the source code that there's a comment that mentions automatically import the utils directory, but it's implemented as scaning directory. So I made a change here and miraculously it no longer prompts the prisma.d.ts exception on my own computer. I submitted the RP, can someone please help me see if it didn't introduce additional issues?

This is interesting. I'm not very familiar with Nitro config, but it seems like addServerScanDir functions similarly to addServerImportDir. I'm guessing this should be okay since the runtime/server directory contains only the utils directory, and no other directories would be left unscanned. Just trying to understand.

@silvesterwali
Copy link

i get same error .

@sahibalejandro
Copy link

For anyone encountering this issue, a temporary workaround is to modify the file node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts by commenting out its contents.

We'll need to see if @ElliottZhao pull request gets approved for a more permanent fix.

@bbhxwl
Copy link

bbhxwl commented Jul 10, 2024

I hope to fix it as soon as possible. I don't know how to use it yet.

@NyllRE
Copy link

NyllRE commented Jul 18, 2024

this should be fixed asap the module is unusable

@jharrell
Copy link
Member

jharrell commented Jul 18, 2024

We are definitely looking into this and will review @ElliottZhao 's PR as soon as possible.

Thanks for your patience 🙏

@ankur-arch
Copy link
Contributor

@ElliottZhao's PR has been merged and released in version 0.0.34. Let me know if this helps resolve the issue.

@ankur-arch ankur-arch added the bug Something isn't working label Jul 29, 2024
@ankur-arch
Copy link
Contributor

Closing this, as it should be fixed as of version 0.0.34.

@bbhxwl
Copy link

bbhxwl commented Jul 30, 2024

Closing this, as it should be fixed as of version 0.0.34.

500
Invalid prisma.rankingLog.count() invocation: Prisma Client could not locate the Query Engine for runtime "rhel-openssl-1.0.x". This happened because Prisma Client was generated for "debian-openssl-3.0.x", but the actual deployment required "rhel-openssl-1.0.x". Add "rhel-openssl-1.0.x" to binaryTargets in the "schema.prisma" file and run prisma generate after saving it: generator client { provider = "prisma-client-js" binaryTargets = ["native", "rhel-openssl-1.0.x"] } The following locations have been searched: /var/www/Nuxt3/.output/server/node_modules/.prisma/client /var/www/Nuxt3/.output/server/node_modules/@prisma/client /drone/src/node_modules/@prisma/client /tmp/prisma-engines

@jharrell
Copy link
Member

@bbhxwl that sounds unrelated and would need a new issue.

However, it's most likely due to your binaryTargets setting. Have you added the suggested line in your schema.prisma?

binaryTargets = ["native", "rhel-openssl-1.0.x"]

@ankur-arch
Copy link
Contributor

@bbhxwl could you verify whether #18 is related to your issue?

ankur-arch added a commit that referenced this issue Nov 27, 2024
Copy link

🎉 This issue has been resolved in version 0.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@quienn
Copy link

quienn commented Dec 1, 2024

error is still there in 0.1.2:

  ➜ DevTools: press Shift + Alt + D in the browser (v1.6.1)                                                                                                                    11:54:46 p.m.

✔ Vite client built in 110ms                                                                                                                                                  11:54:49 p.m.
✔ Vite server built in 1281ms                                                                                                                                                 11:54:50 p.m.

[11:54:53 p.m.]  WARN  [plugin inject] node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse /home/quien/Proyectos/Soluciones/control_valijas/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include


[nitro 11:54:53 p.m.]  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>;
$ cat package.json

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@prisma/nuxt": "^0.1.2",
    "nuxt": "^3.14.1592",
    "nuxt-auth-utils": "^0.5.5",
    "nuxt-authorization": "^0.3.2",
    "vue": "latest",
    "vue-router": "latest",
    "vuetify-nuxt-module": "^0.18.3"
  },
  "devDependencies": {
    "@prisma/client": "^6.0.0",
    "prisma": "^6.0.0"
  }
}

@gsxdsm
Copy link

gsxdsm commented Dec 1, 2024

This issue is still here. Delete (or emptying out) prisma.d.ts in nuxt/dist/runtime/server/utils solves it and doesn't seem to have any negative side effects. But it's not a long term solve.

This is HUGELY annoying and making me consider going to Drizzle. Can this be prioritized?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests