I'd like to be able to access the current Prisma version:
import { version } from "PrismaClient"
console.log(version)
which would print
2.0.0-alpha.785
The main use case for this is to verify our deployment platforms are not out of sync and actually test the latest Prisma version. Also, we think it may be useful if the version string is printed somewhere (maybe additionally in a comment in the first few lines), so users can easily verify that the generated code is indeed generated by a given Prisma version.
You can do the following to get the current Prisma client version:

Thanks for the tip. I'm not sure if this works with tools such as ncc or in specific cloud contexts where node_modules may be handled differently.
Thanks to @timsuchanek
It's here in 2.0.0-alpha.874
https://github.com/prisma/prisma-client-js/commit/f53b9e402dde3c9552d011bf3eb83e43bd557173
Usage:
import { PrismaClient, Post, User, version } from '@prisma/client'
const prisma = new PrismaClient()
console.log(version.client)
This logs latest right now instead of the actual version:
❯ node -e "const { version } = require('@prisma/client'); console.log(version.client)"
latest
Thanks a lot for reporting 🙏
This issue is fixed in the latest alpha version of prisma2.
You can try it out with npm i -g prisma2@alpha.
In case it’s not fixed for you - please let us know and we’ll reopen this issue!
This reports the SHA of the binary version, not the Prisma version. I would have expected to get the Prisma version such as 2.0.0-alpha.785. Additionally, it may make sense to expose the binary version as an additional variable in the version object.
Thanks @steebchen.
We now export the following:
/**
* Query Engine version: 4ff8379527ec7797e7bb5b55d374f82f5812a6f9
* Prisma Client JS version: 2.0.0-alpha.913
*/
exports.version = {
engine: "4ff8379527ec7797e7bb5b55d374f82f5812a6f9",
client: "2.0.0-alpha.913"
}
You can try it out in the latest alpha.
Most helpful comment
Thanks @steebchen.
We now export the following:
You can try it out in the latest alpha.