jetzig-framework / jetzig

Jetzig is a web framework written in Zig
MIT License
308 stars 15 forks source link

jetzig init error #57

Closed linc01 closed 2 months ago

linc01 commented 2 months ago

Hello, I got this error:

`[exec] zig fetch --save https://github.com/jetzig-framework/jetzig/archive/3f6c1a49199e3a3841a710d69f6525a72a744bb7.tar.gz

Error running command: zig fetch --save https://github.com/jetzig-framework/jetzig/archive/3f6c1a49199e3a3841a710d69f6525a72a744bb7.tar.gz

[stdout]:

[stderr]:

error: invalid HTTP response: EndOfStream`

I tried all solutions here zig http/socks5 proxy support, the dirty script works for zig build directly for other projects. I manually wget https://github.com/jetzig-framework/jetzig/archive/3f6c1a49199e3a3841a710d69f6525a72a744bb7.tar.gz and saved it into the same folder ~/.cache/zig/p and renamed the file with the hash, it's not work. Is there a way to bypass this error for jetzig init? Thanks.

The OS is Arch, environment variables http_proxy https_proxy and no_proxy are works well for all the others except zig.

Deecellar commented 2 months ago

We cannot fix the zig fetch error! but we can skip the saving of it @bobf .

We should add a --no-fetch or something like that flag on the init

Will add it in a sec, available to change the name to anything else lol

z1fire commented 2 months ago

maybe --cant-teach-an-old-dog-new-tricks

linc01 commented 2 months ago

We cannot fix the zig fetch error! but we can skip the saving of it @bobf .

We should add a --no-fetch or something like that flag on the init

Will add it in a sec, available to change the name to anything else lol

Thanks, looking forward, I'd like to try jetzig.

linc01 commented 2 months ago

maybe --cant-teach-an-old-dog-new-tricks

I tried to redirect jetzig init to socks5 with graftcp, but it seems not work for zig fetch

bobf commented 2 months ago

@linc01 That's a shame that zig fetch doesn't seem to work for you. As @Deecellar mentioned, fixing this is out of our control, however you can still use Jetzig without much extra manual work:

Basically the only difference between a Jetzig project and a regular Zig project is this line in build.zig:

try jetzig.jetzigInit(b, exe, .{});

You should hopefully then be able to run jetzig generate view <view-name> to create everything you need.

Let us know how you get on, hopefully you can get a project up and running and this GH issue might help other people in future.

It might also be a good idea to file a bug/feature request with Zig itself. Feel free to join us on our Discord if you're still having issues, we'll be happy to help !

linc01 commented 2 months ago

@linc01 That's a shame that zig fetch doesn't seem to work for you. As @Deecellar mentioned, fixing this is out of our control, however you can still use Jetzig without much extra manual work:

* Create a new Zig project with `zig init`

* Copy the [build.zig](https://github.com/jetzig-framework/jetzig/blob/main/demo/build.zig) from the demo project in the Jetzig repository

* Add `jetzig` to your build.zig.zon using the latest commit on `main` (the workaround you mentioned above makes me think that you will know what to do here but let me know if not)

Basically the only difference between a Jetzig project and a regular Zig project is this line in build.zig:

try jetzig.jetzigInit(b, exe, .{});

You should hopefully then be able to run jetzig generate view <view-name> to create everything you need.

Let us know how you get on, hopefully you can get a project up and running and this GH issue might help other people in future.

It might also be a good idea to file a bug/feature request with Zig itself. Feel free to join us on our Discord if you're still having issues, we'll be happy to help !

Thanks @bobf , I've bypassed this error with a proxy variables disabled env. Now I can see a lizard on a jet at 127.0.0.1:8080.

Already joined discord, also opened an issue at the zig repo.