Open dcp3450 opened 1 year ago
Same, I don't believe the -f
flag works at all. Doesn't seem to matter how I do it.
In my case, I'm in a monorepo and running my startup command from a subdirectory (the cwd is a subdirectory that is), and -f ../../.env.js
(or any other filename) fails with the same error you're seeing.
This is why (at least in my case):
{
envFile: {
filePath: '/a/path/.env.js',
fallback: undefined
},
rc: { environments: [ 'default', 'local' ], filePath: undefined },
verbose: false
}
The filePath
that gets passed to getRCFile
is rc.filePath
rather than envFile.filePath
.
Ah, there's a separate option for this: -r, --rc-file [path]
. With all due respect, I think that's a confusing implementation. It should just always use the -f
flag. I can't see any reason you would need to pass both.
I have env-cmd installed locally on a windows 10 setup. Calling
env-cmd -f .env.local
returns the error:Error: Failed to find .env file at default paths: [./.env,./.env.js,./.env.json]
I even installed the library in to my app and run it from the
./node_modules/.bin/env-cmd
and got the same error.