honojs / create-hono

CLI for creating a Hono app
41 stars 12 forks source link

bun create hono on Windows can't clone templates without Node.js #51

Open ryuapp opened 2 weeks ago

ryuapp commented 2 weeks ago

Related: https://github.com/honojs/hono/issues/2992

This problem does not occur if you install Node.js.

C:\Users\xxxx\>bun create hono
create-hono version 0.9.0
? Target directory my-app
? Which template do you want to use? x-basic
? Directory not empty. Continue? yes
✔ Cloning the template
22377 |       projectDependenciesHook.applyHook(templateName, {
22378 |         directoryPath: targetDirectoryPath
22379 |       })
22380 |     );
22381 |   } catch (e) {
22382 |     throw new Error(
                  ^
error: Error running hook for x-basic: No such file or directory
      at C:\Users\xxxx\AppData\Local\Temp\bunx-2632733703-create-hono@latest\node_modules\create-hono\bin:22382:11

Bun v1.1.13 (Windows x64)
ryuapp commented 2 weeks ago

It's node compatibility issue for Bun, but it seems to be caused by readFileSync/writeFileSync below: https://github.com/honojs/create-hono/blob/f7ba1917bd1087c71deeea7e2a408484f08a8ba9/src/hooks/after-create.ts#L11-L16

yusukebe commented 2 weeks ago

Does this mean "node compatibility issue for Bun on Windows"?

ryuapp commented 2 weeks ago

Does this mean "node compatibility issue for Bun on Windows"?

Yes, it does. I tried the same thing in WSL but it didn't reproduce.

ryuapp commented 1 week ago

I had misunderstood this issue a bit. The cause was that template files could not be cloned with Bun. We could only get directories for the template.

image