ui: CLI fails to install components in a PNPM monorepo with shared packages
Hi there! I just reached out on Twitter regarding the CLI monorepo compatibility with PNPM.
Conversation here: https://twitter.com/jordantlewallen/status/1671961810671644673?s=20
However, if you try running a command like:
npx shadcn-ui@latest add button
You receive an error, since I have a package.json that utilizes shared packages that don’t exist on npm
For example I have packages that look like:
"@foundrydev/database": "workspace:*",
"@foundrydev/helpers": "workspace:*",
"@foundrydev/eslint-config-custom": "workspace:*",
"@foundrydev/tsconfig": "workspace:*",
View error log below 👇
View NPM error log
npx shadcn-ui@latest add button
✔ Ready to install components and dependencies. Proceed? … yes
⠼ Installing button...Command failed with exit code 1: npm install @radix-ui/react-slot
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN old lockfile database: No matching version found for database@1.0.0.
npm WARN old lockfile at module.exports (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
npm WARN old lockfile at /Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
npm WARN old lockfile at async Array.<anonymous> (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:718:9)
npm WARN old lockfile Could not fetch metadata for database@1.0.0 database: No matching version found for database@1.0.0.
npm WARN old lockfile at module.exports (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
npm WARN old lockfile at /Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
npm WARN old lockfile at async Array.<anonymous> (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:718:9) {
npm WARN old lockfile code: 'ETARGET',
npm WARN old lockfile type: 'version',
npm WARN old lockfile wanted: '1.0.0',
npm WARN old lockfile versions: [ '0.0.1', '0.0.2' ],
npm WARN old lockfile distTags: { latest: '0.0.2' },
npm WARN old lockfile defaultTag: 'latest'
npm WARN old lockfile }
npm WARN old lockfile tsconfig: No matching version found for tsconfig@0.0.0.
npm WARN old lockfile at module.exports (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
npm WARN old lockfile at /Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
npm WARN old lockfile at async Array.<anonymous> (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:718:9)
npm WARN old lockfile Could not fetch metadata for tsconfig@0.0.0 tsconfig: No matching version found for tsconfig@0.0.0.
npm WARN old lockfile at module.exports (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
npm WARN old lockfile at /Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
npm WARN old lockfile at async Array.<anonymous> (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:718:9) {
npm WARN old lockfile code: 'ETARGET',
npm WARN old lockfile type: 'version',
npm WARN old lockfile wanted: '0.0.0',
npm WARN old lockfile versions: [
npm WARN old lockfile '0.0.1', '0.0.2', '0.0.3',
npm WARN old lockfile '1.0.0', '1.0.1', '1.0.3',
npm WARN old lockfile '1.0.4', '1.0.5', '1.0.6',
npm WARN old lockfile '1.0.7', '1.1.0', '2.0.0',
npm WARN old lockfile '2.0.1', '2.1.0', '2.1.1',
npm WARN old lockfile '2.2.0', '3.0.0', '4.0.0',
npm WARN old lockfile '5.0.0', '5.0.1', '5.0.2',
npm WARN old lockfile '5.0.3', '6.0.0', '7.0.0'
npm WARN old lockfile ],
npm WARN old lockfile distTags: { latest: '7.0.0' },
npm WARN old lockfile defaultTag: 'latest'
npm WARN old lockfile }
npm WARN old lockfile helpers: No matching version found for helpers@1.0.0.
npm WARN old lockfile at module.exports (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
npm WARN old lockfile at /Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
npm WARN old lockfile at async Array.<anonymous> (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:718:9)
npm WARN old lockfile Could not fetch metadata for helpers@1.0.0 helpers: No matching version found for helpers@1.0.0.
npm WARN old lockfile at module.exports (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
npm WARN old lockfile at /Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
npm WARN old lockfile at async Array.<anonymous> (/Users/jordan/GitHub/encore/node_modules/.pnpm/npm@7.24.2/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:718:9) {
npm WARN old lockfile code: 'ETARGET',
npm WARN old lockfile type: 'version',
npm WARN old lockfile wanted: '1.0.0',
npm WARN old lockfile versions: [ '0.0.1', '0.0.3', '0.0.4', '0.0.5', '0.0.6' ],
npm WARN old lockfile distTags: { latest: '0.0.6' },
npm WARN old lockfile defaultTag: 'latest'
npm WARN old lockfile }
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jordan/.npm/_logs/2023-06-22T19_43_19_814Z-debug.log
Anything else I can help provide? Let me know, thanks!
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 2
- Comments: 16
If you’re using
pnpmcheck that you don’t have apackage-lock.jsonoryarn.lockin your project. Delete them, because they’re used by npm/yarn and get shadcn cli confused.This issue also exists using yarn v4/berry and turborepo.
yarn dlx shadcn-ui@latest add resizableIt appears that the add command is not respecting the package manager that called the script and defaulting to
npm install.same issue with bun workspace
bunx --bun shadcn@latest add breadcrumb
Command failed with exit code 1: npm install @radix-ui/react-slot npm error code EUNSUPPORTEDPROTOCOL npm error Unsupported URL Type “workspace:”: workspace:*
For anyone looking for a quick solution, 0.8.0 worked for me (0.9.0 and higher did not).
pnpm dlx shadcn-ui@0.8.0 add alert-dialogI am seeing this issue with my monorepo using latest shadcn-ui, Next.js, and pnpm.
File for the component being added does get created in
@/components/uibut following error appears while adding packages needed by the component. This error occurs for all variations of the CLI command:npx shadcn-ui@latest add buttonpnpx shadcn-ui@latest add buttonpnpm dlx shadcn-ui@latest add buttonManually adding the packages that failed to install works seems to fix the problem but I have not yet checked if there are some additional required steps after the part that fails.
Could shadcn-ui emit a warning along with a list of packages to manually install instead of
Command failed with exit code 1?@shadcn ahhh after all this time using pnpm I didn’t realize that there was an pnpm equivalent to
npxwhich explains my confusion on why I asked on Twitter. Yes this works, thank you @shadcn 😃