Skip to content

[bug]: shadcn init fails on Vite template due to blocked esbuild build script [ERR_PNPM_IGNORED_BUILDS] #10658

Description

@akicho8

Describe the bug

Description

When running shadcn init with the Vite template using pnpm dlx, the initialization process fails during the internal pnpm install step. This is because esbuild requires a build script to run, but pnpm blocks it by default ([ERR_PNPM_IGNORED_BUILDS]), causing the command to exit with code 1.

The real catch-22 here is that shadcn init is supposed to create the project directory from scratch. Even if I wanted to place a pnpm-workspace.yaml to allow the build, the directory doesn't even exist yet, leaving me completely stuck without a pre-configured workaround.

Workaround / Current Solution

Currently, the only way to bypass this is to explicitly allow esbuild via pnpm-workspace.yaml before running the shadcn init command:

cat <<'EOF' > pnpm-workspace.yaml
allowBuilds:
  esbuild: true
EOF

pnpm dlx shadcn@latest init --preset b5K1Dydce --template vite --name my-app

While creating pnpm-workspace.yaml beforehand technically bypasses the exit error, it introduces an even worse architectural mess:

  1. Nested Directories: shadcn init ends up creating the new project inside the folder where the workspace file was placed, resulting in an annoying double-layered folder structure (e.g., my-app/my-app/).
  2. Root Pollution: Because pnpm detects the pre-created pnpm-workspace.yaml, it treats that outer directory as the workspace root. As a result, it generates a massive node_modules and pnpm-lock.yaml at the upper level instead of inside the actual project.

Every single time I run this, I am forced to manually move files around, delete ghost node_modules, and clean up the directory structure just to get a clean start. It completely ruins the seamless "out-of-the-box" experience that shadcn is known for.

Affected component/components

shadcn CLI (init command)

How to reproduce

pnpm dlx shadcn@latest init --preset b5K1Dydce --template vite --name my-app

Codesandbox/StackBlitz link

No response

Logs

[~/tmp] % pnpm dlx shadcn@latest init --preset b5K1Dydce --template vite --name my-app
✖ Something went wrong creating a new Vite project.

Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

Command failed with exit code 1: pnpm install --no-frozen-lockfile

Progress: resolved 1, reused 0, downloaded 0, added 0
Progress: resolved 204, reused 149, downloaded 0, added 0
Packages: +195
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 265, reused 195, downloaded 0, added 195, done

dependencies:
+ @tailwindcss/vite 4.3.0
+ react 19.2.6
+ react-dom 19.2.6
+ tailwindcss 4.3.0

devDependencies:
+ @eslint/js 9.39.4 (10.0.1 is available)
+ @types/node 24.12.4 (25.8.0 is available)
+ @types/react 19.2.14
+ @types/react-dom 19.2.3
+ @vitejs/plugin-react 5.2.0 (6.0.2 is available)
+ eslint 9.39.4 (10.3.0 is available)
+ eslint-plugin-react-hooks 7.1.1
+ eslint-plugin-react-refresh 0.5.2
+ globals 16.5.0 (17.6.0 is available)
+ prettier 3.8.3
+ prettier-plugin-tailwindcss 0.7.4 (0.8.0 is available)
+ typescript 5.9.3 (6.0.3 is available)
+ typescript-eslint 8.59.3
+ vite 7.3.3 (8.0.13 is available)

[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: [email protected]

Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.

You can also try a previous version to see if that works:
pnpm dlx [email protected] init --preset b5K1Dydce --template vite --name my-app

System Info

pnpm -v
11.1.1

Before submitting

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions