Skip to content

Windows Git Bash + zsh without WSL #365

Description

@rafakwolf

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions