dao-xyz / peerbit-getting-started

Boilerplate project for Peerbit projects
0 stars 1 forks source link

Unable to run on windows with node 20 #2

Open Keref opened 1 month ago

Keref commented 1 month ago

Hi, I fail to run anything from peerbit, I think there's a bunch of undocumented configuration but being not too comfortable with typescript I fail to solve things.

This getting-started example fails: jest fails on windows, it seems a known issue, so I figured I'd run simply yarn build. It wants a missing dependency, @peerbit/program

Then it fails with

src/index.test.ts:33:38 - error TS2345: Argument of type 'MyDatabase' is not assignable to parameter of type 'string | Program<never, ProgramEvents>'.
  Type 'MyDatabase' is not assignable to type 'Program<never, ProgramEvents>'.
    Types have separate declarations of a private property '_node'.

33         const db = await client.open(new MyDatabase());

I figured I'd try to make a peerbit app with a vanilla nextjs, I put this index.ts into a file and import + console.log it: I get

Error: No native build was found for platform=win32 arch=x64 runtime=node abi=115 uv=1 libc=glibc node=20.11.0 webpack=true
    loaded from: D:\***\.next\server\vendor-chunks

I have tried the peerbit examples too, nothing works, so I reckon it may be that node 20 isnt supported?

Long story short, how can I use peerbit in practice? Also, how can I run in practice the first example from the doc?

marcus-pousette commented 2 weeks ago

Hi! thanks for creating this isssue, and a slow reply from my side.

rc/index.test.ts:33:38 - error TS2345: Argument of type 'MyDatabase' is not assignable to parameter of type 'string | Program<never, ProgramEvents>'. Type 'MyDatabase' is not assignable to type 'Program<never, ProgramEvents>'. Types have separate declarations of a private property '_node'.

33 const db = await client.open(new MyDatabase());

Sounds like a dependency version issue, or something like that. Have you tried running the tests in the getting started repo?

Interesting that it does not work on windows. Though I am not actively working on windows nor have it part of the build test pipeline, but judging from

Error: No native build was found for platform=win32 arch=x64 runtime=node abi=115 uv=1 libc=glibc node=20.11.0 webpack=true loaded from: D:***.next\server\vendor-chunks

it is hard to know whether this is Peerbit related? 

What I am more looking for is the exact dependency that does not have a native build for your platform? Usually problematic dependencies are those that depend on native builds (usually crypto libs)