nexus-plugin-prisma: t.model does not exist

I am trying to upgrade to Prisma 2 with photon and @prisma/nexus based on this documentation, but am running into this error:

Screenshot 2019-08-23 at 23 27 16

How do I use them together now?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 28 (10 by maintainers)

Most upvoted comments

I had the same error for example project. Additionally, nexus warned that there is no outputs field in object argument passed to makeSchema. So, firstly, I added that field in src/schema.ts:

export const schema = makeSchema({
  //...
  outputs: {
    typegen: __dirname + '/../generated/typings.ts',
    schema: __dirname + '/../generated/schema.graphql',
  },
})

After npm run generate:nexus it created specified files. The wanted definiton was in generated/typings.ts:

declare global {
  interface NexusGenCustomOutputProperties<TypeName extends string> {
    crud: NexusPrisma<TypeName, 'crud'>
    model: NexusPrisma<TypeName, 'model'>
  }
}

So adding the line

/// <reference path="../generated/typings.ts" />

on the top of src/schema.ts resolved type errors. Anyway, i am not sure this is correct solution)

The solution for me was adding the following

  outputs: {
    typegen: path.join(
      __dirname,
      '../node_modules/@types/nexus-typegen/index.d.ts',
    ),
  },

Nice 😃

Also, @prisma/nexus, nexus-prisma and nexus got me quite confused. The docs are quite outdated but I came to the understanding that nexus-prisma is the Nexus plugin, nexus is Nexus core and @prisma/nexus is deprecated, right? What place regarding docs get updated most frequently? prisma/prisma-examples@prisma2, nexus.js.org or prisma/nexus-prisma’s README.md?

I am also running into this issue but with t.crud

The docs are quite outdated but I came to the understanding that nexus-prisma is the Nexus plugin, nexus is Nexus core and @prisma/nexus is deprecated, right?

Congratulations you navigated the confusion well!

What place regarding docs get updated most frequently? prisma/prisma-examples@prisma2, nexus.js.org or prisma/nexus-prisma’s README.md?

Stay tuned, we’ll be doing a sanity pass on docs soon 👍

Reinstalling node_modules did the job for me.

@chenfanggm you shouldn’t need the flag. Or, you may need it once to generate the types needed to typecheck (🐔 🥚 situation).

I’m getting the same issue with t.crud right now. It’s so strange because I’ve rebuilt my docker environment many times throughout the day today and then all of a sudden I started having this issue. I can’t seem to fix it by going through the suggestion made by @chenfanggm in that other thread by setting:

“nexus”: “0.11.7” and “ts-node-dev”: “^1.0.0-pre.40”,

My current setup is: “nexus”: “^0.12.0-beta.6” “@prisma/nexus”: “^0.0.1”, “ts-node”: “^8.3.0”,

Has anyone figured out a winning combination? 😃