N
Nuxt3w ago
IceCrew

Nuxt build move prisma/client to devdependencies

Hello, I am trying to build my project with nuxtbuild when I run the command pnpm run build (npx prisma generate && nuxt build) The client generation works fine
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.22.0) to ./node_modules/@prisma/client in 252ms
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.22.0) to ./node_modules/@prisma/client in 252ms
but when the build launches, it crashes: ERROR ✘ Failed to generate Prisma Client. I've seen that when the nuxt build command is run, the @prisma/client package is moved from the dependencies to the devDependencies and then updated automatically, which is a problem... I've tried to correct this problem by adding an .npmrc but nothing helped
save-exact=true
auto-install-peers=false
strict-peer-dependencies=false
shamefully-hoist=true
enable-pre-post-scripts=true
prefer-frozen-lockfile=true
dedupe-peer-dependencies=false
save-exact=true
auto-install-peers=false
strict-peer-dependencies=false
shamefully-hoist=true
enable-pre-post-scripts=true
prefer-frozen-lockfile=true
dedupe-peer-dependencies=false
thanks in advance, I don't understand why, I think it comes from nuxt but I can't say why it does the same thing with npm
2 Replies
kapa.ai
kapa.ai3w ago
Hi @IceCrew. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I don't have enough specific information to fully address your issue with Prisma Client being moved to devDependencies during the Nuxt build process. However, I can provide some general insights and suggestions based on related Nuxt dependency management information. 1. The issue you're experiencing seems to be related to how Nuxt manages dependencies during the build process. This behavior is not explicitly documented in the provided knowledge sources. 2. Your attempt to use an .npmrc file to control dependency behavior is a good approach. However, the specific settings you've used don't appear to directly address the Prisma Client issue. The .npmrc file you've shown is similar to the one mentioned in this GitHub pull request, which removed the strict-peer-dependencies=false setting as it's now the default. 3. Regarding dependency management, Nuxt has some auto-import features for third-party packages. As mentioned in the Nuxt documentation on auto-imports, you can configure auto-imports in the nuxt.config.ts file. While this doesn't directly solve your Prisma issue, it might be worth checking if there are any auto-import configurations affecting your Prisma setup. 4. There have been issues reported with Nuxt and dependency resolution, as evidenced by this GitHub issue where users experienced problems after updating to a specific Nuxt version. While not directly related to Prisma, it suggests that dependency issues can occur with Nuxt updates. 5. If the problem persists, you might want to try the following: - Ensure that your Nuxt and Prisma versions are compatible. - Check if there are any Nuxt modules or plugins that might be interfering with the Prisma Client. - Try explicitly including @prisma/client in your nuxt.config.ts file's build.transpile array to ensure it's properly handled during the build process. Given the complexity of your issue and the lack of specific information about Prisma Client in the provided knowledge sources, I recommend reporting this as a potential bug to the Nuxt GitHub repository. You can follow the guidelines for reporting bugs in the Nuxt documentation, which includes creating a minimal reproduction of the issue. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@262169755954315281> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?