ui: [bug]: error: Cannot find module '@jridgewell/gen-mapping' from '/private/tmp/bunx-501-shadcn@latest/node_modules/@babel/generator/lib/source-map.js'

Describe the bug

I prompted v0.dev to create a starter template and I copied the command and changed the npx to bunx --bun and ran it only to find this error

error: Cannot find module '@jridgewell/gen-mapping' from '/private/tmp/bunx-501-shadcn@latest/node_modules/@babel/generator/lib/source-map.js'

I only just installed bun so maybe I didn’t configure something write. bunx works for other things like bunx --bun prettier foo.js so I’m sure the problem is a shadcn@latest one. Any help would be appreciated thank you.

Affected component/components

Shadcn CLI

How to reproduce

  1. Install bun
  2. in the terminal run bunx --bun shadcn@latest init

Codesandbox/StackBlitz link

not applicable

Logs

error: Cannot find module '@jridgewell/gen-mapping' from '/private/tmp/bunx-501-shadcn@latest/node_modules/@babel/generator/lib/source-map.js'

System Info

┌─────────────────────────────────────────────────────────────────────────────────────────┐
│  SYSTEMINFORMATION                                                      Version: 5.23.8 │
└─────────────────────────────────────────────────────────────────────────────────────────┘

Operating System:
──────────────────────────────────────────────────────────────────────────────────────────
Platform         : darwin
Distro           : macOS
Release          : 15.1.1
Codename         : macOS Sequoia
Kernel           : 24.1.0
Arch             : arm64
Hostname         : Olalekans-MacBook-Pro.local
Codepage         : UTF-8
Build            : 24B91

System:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : Apple Inc.
Model            : MacBookPro
Version          : 18,3
Virtual          : 

CPU:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : Apple
Brand            : M1 Pro
Family           : 458787763
Model            : 
Stepping         : 4
Speed            : 2.4
Cores            : 8
PhysicalCores    : 8
PerformanceCores : 6
EfficiencyCores  : 2
Processors       : 1
Socket           : SOC

Before submitting

  • I’ve made research efforts and searched the documentation
  • I’ve searched for existing issues

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 34

Most upvoted comments

Screenshot 2024-12-10 at 11 29 17 They seem to have broken the library and now the dist folder it is complaining about is not building.

Downgrading it back to @jridgewell/gen-mapping@0.3.5 works as far as it seems.

New version v0.3.7 is woking now.

I cleared the cache using the following command and then retried, and it worked. I can’t guarantee that it will work for you, but

bun pm cache rm

this worked for me

Same issue on macOS. Tried Node 18 and 22 with both npx and ynpx.

EDIT: It works with Node v20. EDIT(2): Talked too soon. Started spitting out the same error after init.