Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prisma generate throw Error: Expected property name or '}' in JSON at position 29 #38

Open
TenviLi opened this issue Mar 14, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@TenviLi
Copy link

TenviLi commented Mar 14, 2024

I followed the instructions in the README and executed the relevant commands.

However, when I reached the following command, an error occurred.

I searched extensively on search engines but couldn't find a solution.

image

generator client {
  provider = "prisma-generator-drizzle"
}

datasource db {
  provider = "sqlite"
  url      = "file:../prisma.db"
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}
prisma:engines binaries to download libquery-engine, schema-engine +156ms
prisma:get-platform Found distro info:
{
  "targetDistro": "debian",
  "familyDistro": "debian",
  "originalDistro": "ubuntu"
} +4ms
prisma:get-platform Trying platform-specific paths for "debian" (and "ubuntu") +0ms
prisma:get-platform Found libssl.so file using platform-specific paths: libssl.so.3 +0ms
prisma:get-platform The parsed libssl version is: 3.0.x +0ms
prisma:loadEnv project root found at /home/work/package.json +246ms
prisma:tryLoadEnv Environment variables loaded from /home/work/.env +5ms
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
prisma:getConfig Using getConfig Wasm +3ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +7ms
prisma:get-platform Found distro info:
{
  "targetDistro": "debian",
  "familyDistro": "debian",
  "originalDistro": "ubuntu"
} +1ms
prisma:get-platform Trying platform-specific paths for "debian" (and "ubuntu") +0ms
prisma:get-platform Found libssl.so file using platform-specific paths: libssl.so.3 +1ms
prisma:get-platform The parsed libssl version is: 3.0.x +0ms
prisma:getConfig Using getConfig Wasm +34ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +1ms
prisma:getDMMF Using getDmmf Wasm +0ms
prisma:getDMMF Using given datamodel +0ms
prisma:getDMMF dmmf data retrieved without errors in getDmmf Wasm +36ms
prisma:getGenerators neededVersions {} +294ms
Error: Error: 
Expected property name or '}' in JSON at position 29


    at Mf.parse (/home/work/node_modules/.pnpm/prisma@5.10.2/node_modules/prisma/build/index.js:1413:71)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Rgt (/home/work/node_modules/.pnpm/prisma@5.10.2/node_modules/prisma/build/index.js:1892:280)
@farreldarian
Copy link
Owner

farreldarian commented Mar 14, 2024

prisma:getGenerators neededVersions {} +294ms
Error: Error:
Expected property name or '}' in JSON at position 29

at Mf.parse (/home/work/node_modules/.pnpm/prisma@5.10.2/node_modules/prisma/build/index.js:1413:71)

Hey, at first glance, it looks like it comes from the Prisma engine. You can try removing the prisma-generator-drizzle plugin and see if the problem persists.

@TenviLi
Copy link
Author

TenviLi commented Mar 15, 2024

prisma:getGenerators neededVersions {} +294ms
Error: Error:
Expected property name or '}' in JSON at position 29

at Mf.parse (/home/work/node_modules/.pnpm/prisma@5.10.2/node_modules/prisma/build/index.js:1413:71)

Hey, at first glance, it looks like it comes from the Prisma engine. You can try removing the prisma-generator-drizzle plugin and see if the problem persists.

generator client {
  provider = "prisma-client-js"
}

no problem
image

"@prisma/client": "5.10.2",
"better-sqlite3": "^9.4.3",
"drizzle-kit": "^0.20.14",
"prisma": "5.10.2",
"prisma-generator-drizzle": "^0.6.6",
"drizzle-orm": "^0.30.2",

@farreldarian
Copy link
Owner

Do you mind sending me a reproduction repo so I can take a better look?

@farreldarian
Copy link
Owner

@TenviLi this might be unrelated, could you also try using bun 1.0.30?

To install a specific version of bun, follow this step to uninstall and find the "install specific version" here.

@qlaffont
Copy link

qlaffont commented Mar 27, 2024

I have the same error unfortunatly :/ (Bun 1.0.35 / Prisma 5.2.0)

If you want to test it, I can give you an example :


datasource db {
  provider = "postgresql"
  url      = "postgresql://docker:docker@localhost:5432/project"
}
generator drizzle {
  provider = "prisma-generator-drizzle"

}

model Token {
  id           String @id @unique @default(uuid())
  refreshToken String
  accessToken  String

  owner   User   @relation(fields: [ownerId], references: [id])
  ownerId String

  createdAt DateTime @default(now())
}

model User {
  id            String  @id @unique @default(uuid())

  tokens          Token[]

  createdAt       DateTime         @default(now())
  updatedAt       DateTime         @updatedAt
}

@farreldarian
Copy link
Owner

@qlaffont @TenviLi It seems that the problem is arising from comments in the tsconfig.json file, as JSON does not support comments by default. I've just released version 0.6.7 to address this issue. Please give it a try and let me know if it doesn't resolve the issue.

@qlaffont
Copy link

qlaffont commented Apr 3, 2024

Nop :/

> starter-api@1.0.0 generate /home/quentin/Documents/dev/perso/starter-api
> prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: 
Expected double-quoted property name in JSON at position 622

@farreldarian
Copy link
Owner

Nop :/

> starter-api@1.0.0 generate /home/quentin/Documents/dev/perso/starter-api
> prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: 
Expected double-quoted property name in JSON at position 622

Do you mind to modify this repository to reproduce your error?

@qlaffont
Copy link

qlaffont commented Apr 5, 2024

Strange I don't reproduce the error with deps I have installed...

@farreldarian farreldarian added the bug Something isn't working label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants