Skip to content
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

bug: sed: can't read s#:password@#:ct3IsgNa0C72S4R3@#: No such file or directory #2088

Open
MoshPitCodes opened this issue Mar 26, 2025 · 0 comments

Comments

@MoshPitCodes
Copy link

Provide environment information

System:
OS: Linux 6.13 cpe:/o:nixos:nixos:25.05 25.05 (Warbler)
CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
Memory: 7.75 GB / 15.24 GB
Container: Yes
Shell: 5.9 - /run/current-system/sw/bin/zsh
Binaries:
Node: 22.14.0 - /etc/profiles/per-user/moshpitcodes/bin/node
npm: 10.9.2 - /etc/profiles/per-user/moshpitcodes/bin/npm
pnpm: 10.6.3 - /etc/profiles/per-user/moshpitcodes/bin/pnpm

Describe the bug

When scaffolding the project on Linux (NixOS in my specific case) and running the ./start-database.sh script sed throws the following error:

The issue seems to stem from sed expecting a blank space between the -i flag and the single quotes on macOS, but does not require this on Linux (Linux expects -i'' or simply -i). This appears to be the case because macOS uses BSD sed while Linux uses GNU sed.

Reproduction repo

https://github.com/t3-oss/create-t3-app/

To reproduce

  1. pnpm create t3-app@latest
  2. ./start-database.sh
  3. Select generation of new password
  4. Observe console logs

Additional information

Adjusting the ./start-database.sh script as follows seems to fix it for me:

# Generate a random URL-safe password
  DB_PASSWORD=$(openssl rand -base64 12 | tr '+/' '-_')
  if [[ "$OSTYPE" == "darwin"* ]]; then
      sed -i '' "s#:password@#:$DB_PASSWORD@#" .env
  else
      sed -i "s#:password@#:$DB_PASSWORD@#" .env
  fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant