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

Trying to use .env-cmdrc.js fails with "Invalid .rc file path" #79

Closed
tivac opened this issue Jul 19, 2019 · 2 comments
Closed

Trying to use .env-cmdrc.js fails with "Invalid .rc file path" #79

tivac opened this issue Jul 19, 2019 · 2 comments

Comments

@tivac
Copy link

tivac commented Jul 19, 2019

I'm trying to use the support for .env-cmdrc.js along with the --environments flag to allow me to do merging of environments within the environments file to avoid my scripts from getting too long.

Unfortunately it seems like there's a bug in env-cmd around resolving the fallback files. I can see where the code is set up to try and do that, but it fails on the first file.

I've created a repro as a gist

Here's the error I get when trying to use env-cmd with a .env-cmdrc.js file in the same dir:

Error: Invalid .rc file path.
    at Object.<anonymous> (C:\Users\tivac\Desktop\env-cmd-test\node_modules\env-cmd\dist\parse-rc-file.js:27:19)
    at Generator.throw (<anonymous>)
    at rejected (C:\Users\tivac\Desktop\env-cmd-test\node_modules\env-cmd\dist\parse-rc-file.js:5:65)
  • node@10.12.0
  • npm@6.9.0
  • env-cmd@9.0.3
@Akkuma
Copy link
Contributor

Akkuma commented Jul 26, 2019

I've tracked down the problem. The problem is that https://github.com/toddbluhm/env-cmd/blob/master/src/get-env-vars.ts#L54 doesn't await the promise ever, which means it never catches the error. Additionally, env-cmd is being compiled for pre-Node v8, which is strange, seeing as how Node v6 is dead and v8 is going to EOL at the end of this year too.

Akkuma added a commit to Akkuma/env-cmd that referenced this issue Jul 26, 2019
@toddbluhm
Copy link
Owner

env-cmd@10.0.0 has been published with this fix

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

3 participants