Skip to content

npx cap add @capacitor-community/electron fails if there's a space in the path. #303

@skoczen

Description

@skoczen

Describe the bug
Running npx cap add @capacitor-community/electron fails if there's a space anywhere in the path name.

Error thrown for dir /Users/person/path-with space:

Adding Electron platform:
node:internal/process/promises:392
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "/bin/sh: line 0: cd: /Users/person/path-with : No such file or directory

To Reproduce
Steps to reproduce the behavior:

  1. Make a folder with a space somewhere in the path.
  2. Follow the official getting started steps.
  3. Run step 3: npx cap add @capacitor-community/electron
  4. See the error.

Expected behavior
Commands should properly escape spaces and other special characters in paths, and run without errors.

Desktop (please complete the following information):

  • OS: MacOS 15.5
  • Npm:
"@capacitor-community/electron": "^5.0.1",
"@capacitor-community/keep-awake": "^7.0.0",
"@capacitor/android": "^7.2.0",
"@capacitor/cli": "^7.2.0",
"@capacitor/core": "^7.2.0",
"@capacitor/ios": "^7.2.0",

Thanks!

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