Skip to content

Invalid configuration error due to unremovable trailing space in components.json #8941

@librariums

Description

@librariums

Bug Description

The shadcn CLI fails with "Invalid configuration found in components.json" due to a trailing space in the $schema URL ("https://ui.shadcn.com/schema.json "). Critically, this space cannot be removed by standard file operations.

Environment

  • Node.js: v24.11.1
  • npm: 11.6.4
  • OS: Linux (ChromeOS Crostini)
  • Filesystem: btrfs
  • shadcn: latest

Reproduction Steps

  1. Create components.json with trailing space after schema URL
  2. Run npx shadcn@latest add button
  3. Get error: Invalid configuration found
  4. Attempt to remove space with:
    • sed -i 's|schema\.json[[:space:]]*"|schema.json"|' components.json
    • awk '{gsub(/schema\.json "/, "schema.json\""); print}' > tmp
    • printf '...' > components.json (heredoc)
    • cp /tmp/fixed.json components.json
  5. Verify with cat -A: space still present (`"schema.json $")
  6. Permissions check: `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions