In the graphql-js/4-adding-a-database tutorial I got Cannot find module 'prisma-client-lib error when running the example code below:
const { prisma } = require('./generated/prisma-client')
async function main() {
// Create a new link
const newLink = await prisma.createLink({
url: 'www.prisma.io',
description: 'Prisma replaces traditional ORMs',
})
console.log(`Created new link: ${newLink.url} (ID: ${newLink.id})`)
// Read all links from the database and print them to the console
const allLinks = await prisma.links()
console.log(allLinks)
}
main().catch(e => console.error(e))
This is resolved by running yarn add prisma-client-lib as specified in the prisma official documentation.
This is actually specified on the next step of the tutorial, so this is not relevant. https://www.howtographql.com/graphql-js/5-connecting-server-and-database/
Most helpful comment
This is actually specified on the next step of the tutorial, so this is not relevant. https://www.howtographql.com/graphql-js/5-connecting-server-and-database/