Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. Alexey
    A

    Alexey

    @Alexey

    Chat Follow Unfollow
    0
    Reputation
    1
    Posts
    174
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with Alexey
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    Alexey Follow

    Posts made by Alexey

    RE: Postinstall scripts are not being run(solved)

    @jdansercoer I've found a workaround for this problem.

    I use manual deployments via server code uploading in UI.

    By default prisma generate creates client code in node_modules/.prisma/client and @prisma/client expects to find client and types there. If client is not generated you see this error Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again..
    It's possible to change default location for generated code to allow prisma to load it from there. This is what I use to include generated client to my src folder which will be included into final build which I upload in UI.

    generator client {
      provider = "prisma-client-js"
      output   = "../src/db/client"
      binaryTargets = ["native", "debian-openssl-1.1.x"]
    }
    

    Note: make sure to import your client from generated code (import { PrismaClient } from "../db/client";
    by providing generated Prisma client outside of node_modules/ you make it unnecessary to run use postinstall script.

    General solution:

    1. Change Prisma config to store generated client outside of node_modules
    2. Change imports to point directly to generate client.
    3. Make sure to include generated client into deployment. E.g. include yarn copyfiles -u 1 \"src/db/**/*\" ./build into build step.
    posted in Colyseus Arena - Cloud Hosting •