Skip to content

CLI fails when project path contains spaces (execPrisma: unquoted prismaPath) #609

@sourcebert

Description

@sourcebert

Description

Running Prisma-related ZenStack CLI commands fails when the project is located in a directory whose path contains spaces.

In packages/cli/src/utils/exec-utils.ts (execPrisma()), the resolved Prisma entry file is executed like this:

execSync(`node ${prismaPath} ${args}`, _options);

Because ${prismaPath} is not quoted, the shell splits the path on spaces and the command breaks.

Relevant code:
packages/cli/src/utils/exec-utils.ts

Steps to Reproduce

  1. Create / move a ZenStack v3 project into a folder that contains spaces in its path
    (e.g. .../My Projects/zen-demo or C:\Users\...\My Projects\zen-demo)
  2. Run a command that triggers execPrisma, e.g.: pnpm zen push db

Behavior

The CLI aborts because the node command receives a truncated / split script path.

Conceptually, the executed command looks like: node /.../My Projects/.../node_modules/... and the shell interprets /.../My as the script path (or otherwise splits it), causing a "Cannot find module" error.

Environment

  • OS: Fedora (Linux)
  • Node.js: 25.3.0
  • pnpm: 10.28.0
  • @zenstackhq/cli: 3.2.1

Proposed Quick Fix

Quote the resolved Prisma path:

execSync(`node "${prismaPath}" ${args}`, _options);

More robust change

Use execFileSync / spawnSync with an args array (no shell parsing / should work in every environment).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions