Skip to content

fix(setup): quote paths in shell commands to support spaces in project path #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adarsh-mamgain
Copy link
Contributor

Fix: Quote paths in setup.js shell commands to support spaces in project path

Problem:
The setup script failed when the project directory contained spaces, due to unquoted file paths in shell commands (e.g., tar xf /Users/adarshmamgain/Micro SaaS/Cap/target/native-deps-aarch64-darwin-apple.tar.xz -C /Users/adarshmamgain/Micro SaaS/Cap/target/native-deps).

➜  Cap git:(fix/setup-quote-paths) ✗ pnpm cap-setup
 WARN  Unsupported engine: wanted: {"node":"20"} (current: {"node":"v23.11.0","pnpm":"10.5.2"})

> cap@ cap-setup /Users/adarshmamgain/Micro SaaS/Cap
> dotenv -e .env -- node scripts/setup.js

Downloading native-deps-aarch64-darwin-apple.tar.xz
Downloaded native deps
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: tar xf /Users/adarshmamgain/Micro SaaS/Cap/target/native-deps-aarch64-darwin-apple.tar.xz -C /Users/adarshmamgain/Micro SaaS/Cap/target/native-deps
tar: Error opening archive: Failed to open '/Users/adarshmamgain/Micro'

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at ChildProcess.exithandler (node:child_process:414:12)
    at ChildProcess.emit (node:events:507:28)
    at maybeClose (node:internal/child_process:1101:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:507:28)
    at Pipe.<anonymous> (node:net:351:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'tar xf /Users/adarshmamgain/Micro SaaS/Cap/target/native-deps-aarch64-darwin-apple.tar.xz -C /Users/adarshmamgain/Micro SaaS/Cap/target/native-deps',
  stdout: '',
  stderr: "tar: Error opening archive: Failed to open '/Users/adarshmamgain/Micro'\n"
}

Node.js v23.11.0
 ELIFECYCLE  Command failed with exit code 1.

Solution:

  • All shell commands in scripts/setup.js that use file paths are now properly quoted.
  • This ensures the setup works regardless of whether the project path contains spaces.

Tested:

  • Ran setup in a directory with spaces and without spaces; both succeed.

Note:
If you encounter similar issues elsewhere, ensure all shell commands are properly quoted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant