honojs / create-hono

CLI for creating a Hono app
52 stars 14 forks source link

Segmentation fault when creating projects with `npm create hono@latest` #35

Closed prosenjitjoy closed 5 months ago

prosenjitjoy commented 5 months ago

Context

Running a simple command like npm create hono@latest ./my-app -- --template cloudflare-pages gives

create-hono version 0.7.0
✔ Using target directory … ./my-app
Segmentation fault (core dumped)

Expected

Should work as intended to create projects using different templates.

Device

Kernel: Linux 6.8.7 Distro: Fedora 40 Node: 20.12.2 NPM: 10.5.0 Git: 2.44.0

yusukebe commented 5 months ago

Hi @prosenjitjoy

Is git installed in your machine?

prosenjitjoy commented 5 months ago

Hi @prosenjitjoy

Is git installed in your machine?

はい、@yusukebe

My current workaround

creating project manually by copying templates from https://github.com/honojs/starter

Most likely caused by

The problem seems to be with a package called ora. If i remove every instance of spinner(ora) lines from source and run the binary after build it works as intended without any segmentation fault.

Before

prosenjit@joy:/tmp/create-hono$ chmod +x bin 
prosenjit@joy:/tmp/create-hono$ ./bin 
create-hono version 0.7.0
? Target directory my-app
? Which template do you want to use? vercel
? Directory not empty. Continue? yes
Segmentation fault (core dumped)

After

prosenjit@joy:/tmp/create-hono$ chmod +x bin 
prosenjit@joy:/tmp/create-hono$ ./bin 
create-hono version 0.7.0
? Target directory my-app
? Which template do you want to use? nodejs
? Do you want to install project dependencies? yes
? Which package manager do you want to use? npm
🎉 Copied project files
Get started with: cd my-app
ryuapp commented 5 months ago

Probably related to the following: https://github.com/sindresorhus/ora/issues/229

yusukebe commented 5 months ago

Hi @prosenjitjoy @ryuapp

It seems to be related to that ora issue. The easiest way to resolve this issue is to not use ora, but there is no good spinner library, and I'd like to keep using ora.

@ryuapp Or do you know any other library or idea to solve this?

ryuapp commented 5 months ago

Hi @yusukebe I found nanospinner(https://github.com/usmanyunusov/nanospinner). I tried it on local and it looks fine.

I can't confirm whether this solves segmentation fault problems because I can't reproduce it, but I think it will work.

yusukebe commented 5 months ago

@ryuapp

That's good, only on dependency! If you can, could you create the PR to replace ora with nanospinner?

yusukebe commented 5 months ago

Hi @prosenjitjoy

I've released v0.7.1 now, which includes the fix that replaces ora with nanospinner by @ryuapp #37

Could you try it and let us know the result?

prosenjitjoy commented 5 months ago

It is now working. Thanks.