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
- Create
components.json with trailing space after schema URL
- Run
npx shadcn@latest add button
- Get error:
Invalid configuration found
- 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
- Verify with
cat -A: space still present (`"schema.json $")
- Permissions check: `