oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.53k stars 2.71k forks source link

Create a Hono not working sometimes #1595

Closed danielsrod closed 1 month ago

danielsrod commented 1 year ago

What version of Bun is running?

0.3.0

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

when I type: $ bun create hono ./hono-app

What is the expected behavior?

Install the hono dependencies and run the project

What do you see instead?

daniel@daniel:/mnt/c/projects/personal/hono-app$ bun run src/index.ts

error: Could not resolve: "hono". Maybe you need to "bun install"? import { Hono } from "hono"; ^ /mnt/c/projects/personal/hono-app/src/index.ts:1:22 21

error: Could not resolve: "hono/serve-static.bun". Maybe you need to "bun install"?

import { serveStatic } from 'hono/serve-static.bun'; ^ /mnt/c/projects/personal/hono-app/src/index.ts:2:29 57

Additional information

I'm using Windows 10, WSL2, Ubuntu 20.04.1 LTS.

When we create a hono app with bun create hono, it will install 2 dependencies (hono and bun-types) in node_modules.

Curiously, the files of the hono dependencie is not being downloaded. The folder ./node_modules/hono is empty, and folder bun-types contains this files README.md package.json types.d.ts. So, when I try to run bun run src/index.ts the problem shows up.

Sometimes, but only few times, when everything goes well, hono folder in node_modules contain its files and bun-types is empty.

Thats what I get.

UPDATE #1 Now, I also try to create a blank template with bun init and add hono with bun add hono

hono folder inside node_modules is empty again

UPDATE #2 I'm trying with other packages. Axios install at first attemp, but I also try oracledb package, but same history. oracledb folder inside node_modules is empty.

UPDATE #3 So, looking for a resolution, I saw some awesome people using bun install --backend=copyfile, I tried and works. But, for sure bun create hono is scufed.

Jarred-Sumner commented 1 year ago

It sounds like this is an issue where bun install isn't correctly detecting when hardlinking between directories is unsupported

We really need to add a test for this

cc @dylan-conway

birkskyum commented 10 months ago

@danielsrod - this appear to be working on Darwin 23.3.0 arm64 arm. Can you check with latest bun version?

Electroid commented 8 months ago

Going to close since this was likely fixed. If you're still experiencing this issue, let us know and we'll re-open it.

K4leri commented 7 months ago

Going to close since this was likely fixed. If you're still experiencing this issue, let us know and we'll re-open it.

Still the same issue

What version of Bun is running?

1.0.29+a146856d1

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

k4leri@DESKTOP-D0L1A7L:~/projects/bunProjects/hono$ bun create hono
/tmp/bunx-1000-create-hono@latest/node_modules/create-hono/bin:23083
      #parts = [];
      ^

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

bunx create-hono make the same issue

birkskyum commented 7 months ago

In that case this issue would appear to be quite platform specific.

sculpt0r commented 6 months ago

As for: macOS 14.4 M2 PRO

bun -v: 1.1.0

bunx create-hono ./ /private/tmp/bunx-501-create-hono@latest/node_modules/create-hono/bin:19243 var segmenter = new Intl.Segmenter(); ^

TypeError: Intl.Segmenter is not a constructor at Object. (/private/tmp/bunx-501-create-hono@latest/node_modules/create-hono/bin:19243:17) at Module._compile (internal/modules/cjs/loader.js:1114:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10) at Module.load (internal/modules/cjs/loader.js:979:32) at Function.Module._load (internal/modules/cjs/loader.js:819:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) at internal/main/run_main_module.js:17:47

github-actions[bot] commented 1 month ago

This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.

Jarred-Sumner commented 1 month ago

Intl.Segmenter should work as of Bun v1.1.16 or so