medz / prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.
https://prisma.pub
BSD 3-Clause "New" or "Revised" License
436 stars 29 forks source link

[SETUP] can't generate prisma_client.dart #232

Closed Bill-ON-epitech closed 5 months ago

Bill-ON-epitech commented 1 year ago
$ dart --version
Dart SDK version: 3.0.2 (stable) (Tue May 23 08:26:58 2023 +0000) on "linux_x64"

$ npm --version
9.6.7

OS NAME : Ubuntu 22.04.2

Hello, Following the Getting Started Tutorial is fine up to : npx prisma db push After executing this command, the tutorial's video shows the creation of the file "prisma_client.dart" inside the lib folder. But only the file "db.sqlite" was generated in the prisma folder. The output of npx prisma db push is :

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "db.sqlite" at "file:./db.sqlite"

SQLite database db.sqlite created at file:./db.sqlite

🚀  Your database is now in sync with your Prisma schema. Done in 26ms

Running generate... (Use --skip-generate to skip the generators)
Building package executable... (5.7s)
Built orm:orm.

Also running dart run orm --help should show me what arguments i can use, but it seems the process just waits for my input as if i press enter, i get :

{"jsonrpc":"2.0","error":{"code":-32700,"message":"Invalid JSON: Unexpected end of input","data":{"request":""}},"id":null}
medz commented 1 year ago

@Bill-ON Ok, I'm going to go through the process you described ~ and use it to confirm your question

medz commented 1 year ago

@Bill-ON Can you take a look at your schema.prisma file content and pubspec.yaml content? I just walked through the tutorial I wrote before and was able to generate

Bill-ON-epitech commented 1 year ago

@medz schema.prisma :

/ This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider = "dart run orm"
}

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

model Users {
   id Int @id @default(autoincrement())
   name String
   email String @unique
}

pubspec.yaml :

name: hello
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo

environment:
  sdk: ^3.0.2
dependencies:
  json_annotation: ^4.8.1
  orm: ^3.4.3
dev_dependencies:
  build_runner: ^2.4.4
  json_serializable: ^6.7.0
  lints: ^2.1.1
medz commented 1 year ago

@Bill-ON Maybe it's a network problem~ I can generate it correctly through the dependencies and schema you provided

Bill-ON-epitech commented 1 year ago

@medz so my computer has a dual boot ubuntu/windows and i tested the installation process and it works perfectly on windows ??? Without displaying any warning prompts, everytime i entered npx prisma db push, my database tables were all deleted; to be replaced by the model in schema.prisma. I will abandon working on ubuntu and instead use Windows. So you can consider this problem solved. Still thank you very much for responding so quickly

matav commented 1 year ago

I have same problem on Ubuntu: dart --version Dart SDK version: 2.19.6 (stable) (Tue Mar 28 13:41:04 2023 +0000) on "linux_x64" npm --version 9.7.1

dart run orm --help {"jsonrpc":"2.0","error":{"code":-32700,"message":"Invalid JSON: Unexpected end of input","data":{"request":""}},"id":null}

I have the tables in the database generated, but the client in Dart has not been generated.