adminjs-prisma
adminjs-prisma copied to clipboard
Cannot find module '@adminjs/prisma' or its corresponding type declarations.ts(2307)
"@adminjs/prisma": "^4.0.0",
when I installed v4.0.0 it can't find only '@adminjs/prisma' when '@adminjs/sql' and '@adminjs/express' works well.
I removed node_modules and package-lock.json and reinstalled but still same error.
Hello!
You might want to modify tsconfig.json
, changing property moduleResolution
value to Node16
. I've had Node
and I had the same issue.
same issue. changing moduleResolution
didn't work.
Same issue here
I have the same problems and I tried using different versions of @adminjs/prisma.
Did you try importing without * as AdminJSPrisma
? This could be wrapping the entire module into another namespace hence TS complaints.
Try to do the imports similar to example app: https://github.com/SoftwareBrothers/adminjs-prisma/blob/main/example-app/src/index.ts
Yes, @dziraf. Same problem.
Not sure if important, but I'm using Ubuntu 22 with WSL2, Windows 11.
can you share package.json
and tsconfig.json
?
I was actually trying to append AdminJS in an existing project, but after seeing the same problem, I created a new project from scratch with just the default package.json and following the basic Getting Started section on AdminJS's website. So this is the current package.json:
{
"name": "adminjs-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@adminjs/express": "^6.0.0",
"@adminjs/prisma": "^5.0.1",
"adminjs": "^7.2.0",
"express": "^4.18.2",
"express-formidable": "^1.2.0"
}
}
Yeah, seems to be a general problem for me, too. In different projects.
Looks like you might need:
"type": "module"
in your package.json
since AdminJS is ESM-only now. Some tsconfig.json
modifications might be needed as well but from my experience setting module
and moduleResolution
to nodenext
is enough. Alternatively, you can try to set up the example app from this repo and look for differences in setup since it works for me.
Thanks for the advice! Unfortunately, I can't add those changes to my project. For now, I'm using ts-ignore comments to suppress the AdminJS errors. If problems persist, I might roll back AdminJS or consider alternatives as a last resort. Thank you for your help!
This fixed the issue, thanks!
Hello, still got the same issue here,
Got "type": "module"
"@adminjs/prisma": "^5.0.3"
in my package.json
and"moduleResolution": "bundler"
in my tsconfig.json
same issue tried different tsconfig.json configurations but same issue persists.