Prisma: Wrong output from `prisma2 init` prints to import `PrismaClient` from 'prisma-client-js' instead of '@prisma/client'

Created on 29 Jan 2020  ·  3Comments  ·  Source: prisma/prisma

Just saw the recent changes on Preview 20. I was wondering what’s the difference between both?

When I do npx prisma2 init, I got the following in the terminal with other stuff which I omitted for brevity:

import { PrismaClient } from 'prisma-client-js'
// or const { PrismaClient } = require('prisma-client-js')

const prisma = new PrismaClient()

But in the Getting Started guide, I see on Step No. 7

import { PrismaClient } from ‘@prisma/client’

Which one to use? Are both valid & one & the same? It’s confusing me :(

bu2-confirmed kinbug

All 3 comments

Hey @deadcoder0904, the current output from prisma2 init is wrong and will be fixed soon. I'll leave this issue open to track this (also adjusted the title) 🙂

The right way to import Prisma Client in your application is:

import { PrismaClient } from ‘@prisma/client’

This has already been merged. Current content: https://github.com/prisma/prisma2/blob/d4305267ee5b7d7c59e28e339716b7da0d4df50c/cli/introspection/src/commands/Init.ts#L139-L141 This is available in alpha, and will be included in the next preview release.

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!

Was this page helpful?
0 / 5 - 0 ratings