Skip to content

Error nuxt / prisma : Invalid module ".prisma" is not a valid package name imported from ...\node_modules\@prisma\client\default.js #27274

@DraayZe

Description

@DraayZe

Hi everyone, i'm working on a personnal web project with nuxt and prisma. When i try to build my project i have this error (title). I tried several solutions to solve it but none worked. Maybe i made a mistake ?
Can i get some help ?

Here are some files that may be useful:

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/client": "^6.8.2"?
"nuxt": "^3.16.2",
"
},
"devDependencies": {
"prisma": "^6.8.2",

}
}

nuxt.config;ts :
export default defineNuxtConfig({
compatibilityDate: '2024-11-01',
devtools: { enabled: true },
css: ['/assets/css/main.css'],
components: true,
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
plugins: ['
/plugins/pinia.js'],
modules: [
'@vueuse/nuxt'
],
build: {
transpile: ['@motionone/vue']
}
})

prisma.ts : import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

export default prisma;

schema.prisma : generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

ERROR Invalid module ".prisma" is not a valid package name imported from ...\node_modules@prisma\client\default.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: generator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions