Skip to content

[Bug] Module not found error after global install - bin script references source file not included in package #1

@geooff

Description

@geooff

Description

After installing @dannote/figma-use globally with bun, running figma-use fails with a module not found error
pointing to a TypeScript source file that isn't included in the published package.

Steps to Reproduce

bun install -g @dannote/figma-use                                                                                      
figma-use    

The Error

error: Module not found "/Users/<user>/node_modules/@dannote/figma-use/packages/cli/src/index.ts"                      

Workaround

I got claude code to fix this with the following

Patch ~/node_modules/@dannote/figma-use/bin/figma-use.js to use the compiled output:

  #!/usr/bin/env bun                                                                                                     
  import { spawn } from 'child_process'                                                                                  
  import { fileURLToPath } from 'url'                                                                                    
  import { dirname, join } from 'path'                                                                                   
                                                                                                                         
  const __dirname = dirname(fileURLToPath(import.meta.url))                                                              
  const cliPath = join(__dirname, '..', 'dist', 'cli', 'index.js')                                                       
                                                                                                                         
  const child = spawn('bun', ['run', cliPath, ...process.argv.slice(2)], { stdio: 'inherit' })                           
  child.on('exit', (code) => process.exit(code || 0))

This resolves the issue and the CLI works as expected.

Environment

  • Package version: 0.6.0
  • bun: 1.3.6
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions