Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ryuapp opened this issue Jun 20, 2024 · 4 comments
Open

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

ryuapp opened this issue Jun 20, 2024 · 4 comments

Comments

@ryuapp
Copy link
Contributor

ryuapp commented Jun 20, 2024

Related: honojs/hono#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 ryuapp changed the title bun create hono on Windows can't clone templates bun create hono on Windows can't clone templates without Node.js Jun 20, 2024
@ryuapp
Copy link
Contributor Author

ryuapp commented Jun 20, 2024

It's node compatibility issue for Bun, but it seems to be caused by readFileSync/writeFileSync below:

const wrangler = readFileSync(wranglerPath, 'utf-8')
const convertProjectName = projectName
.toLowerCase()
.replaceAll(/[^a-z0-9\-_]/gm, '-')
const rewritten = wrangler.replaceAll(PROJECT_NAME, convertProjectName)
writeFileSync(wranglerPath, rewritten)

@yusukebe
Copy link
Member

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

@ryuapp
Copy link
Contributor Author

ryuapp commented Jun 21, 2024

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
Copy link
Contributor Author

ryuapp commented Jun 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants