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

Windows Git Bash + zsh without WSL #365

Open
rafakwolf opened this issue Jun 28, 2023 · 1 comment
Open

Windows Git Bash + zsh without WSL #365

rafakwolf opened this issue Jun 28, 2023 · 1 comment

Comments

@rafakwolf
Copy link

Hi folks, I know that it's likely an edge case, but any help would be great.

I'm using git bash on Windows 11

❯ git -v
git version 2.41.0.windows.1

and installed zsh following this tutorial: https://dev.to/equiman/zsh-on-windows-without-wsl-4ah9 and almost everything is working fine

I have the following scripts on my package.json

"load-api-env-vars": "./node_modules/.bin/env-cmd -f ./packages/project-api/.env",
"api:start": "yarn load-api-env-vars nx run project-api:serve"

looking into the env-cmd bin file:

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

however, when I ran uname here's the result:

❯ uname
MINGW64_NT-10.0-22621

and even adding something like that, it's not working

case `uname` in
    *MINGW64*) basedir=`cygpath -w "$basedir"`;;
esac

So I put a console.log to investigate a bit more:

❯ yarn load-api-env-vars
yarn run v1.22.19
$ ./node_modules/.bin/env-cmd -f ./packages/project-api/.env
getEnvVars options { envFile: undefined, rc: undefined, verbose: false }
Error: Failed to find .env file at default paths: [./.env,./.env.js,./.env.json]
    at getEnvFile (C:\Users\user\work\fwd\node_modules\env-cmd\dist\get-env-vars.js:59:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.EnvCmd (C:\Users\user\work\fwd\node_modules\env-cmd\dist\env-cmd.js:39:15)
    at async Object.CLI (C:\Users\user\work\fwd\node_modules\env-cmd\dist\env-cmd.js:19:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Looks like even specifying the "-f env-file-path", in the options it is still empty.

Thanks!

@toddbluhm
Copy link
Owner

toddbluhm commented Dec 4, 2024

I do believe this resulted from either one of two issues.

  1. The usage of commander and how I parsed out provided arguments was wonky/hacky. I have since fixed that on master and soon v11 by now utilizing the supported -- separator between env-cmd args and the actual command to run with args. This separator I think also provides better readability and clarity on the command line.

  2. I was not properly constructing paths between Windows/Unix pathing styles. I am now utilizing built-in node utils to help resolve/switch between windows/unix style pathing.

Feel free to give the current master a shot and see if that resolves your issues.

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

No branches or pull requests

2 participants