Failed to find .rc file at default paths: [./.env-cmdrc,./.env-cmdrc.js,./.env-cmdrc.json]
See original GitHub issueThis has been reported already in #118 but the OP closed it. The reason for this error message in both my case in issue 118’s OP was that the .env-cmd was not valid JSON and could not be parsed correctly which would have been much more helpful error message than this confusing information about env-cmd not being able to find the .rc file. The issue lies here in get-env-var.js inside the catch that is muting all exceptions except EnvironmentError, I added a comment and console.log there to debug locally:
for (const path of RC_FILE_DEFAULT_LOCATIONS) {
try {
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath: path });
if (verbose === true) {
console.info(`Found environments: [${environments.join(',')}] for default .rc file at path: ${path}`);
}
return env;
}
catch (e) {
// not sure why you want mute exceptions other than "EnvironmentError", add the console.log in the line below to see the true error being muted.
console.log(`ERROR: ${e}`);
if (e.name === 'EnvironmentError') {
const errorText = `Failed to find environments: [${environments.join(',')}] for .rc file at path: ${path}`;
if (verbose === true) {
console.info(errorText);
}
throw new Error(errorText);
}
}
}
Maybe you could just rethrow the error below the “if” statement to make sure errors are not muted.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:18
- Comments:13 (1 by maintainers)
Top Results From Across the Web
env-cmd Error: Failed to find .env file at path - Stack Overflow
If you're using .env-cmdrc make sure that you haven't missed any commas and your file structure corresponds to the JSON structure.
Read more >Failed to find .env file. Error command env-cmd ... - YouTube
Failed to find .env file at default paths : [./.env,./.env. js,./.env. json ].While running the to start the server using the command. cmd:...
Read more >env-cmd - Bountysource
env-cmdrc syntax error but prompts 'Error: Failed to find .rc file at default paths' $ 0. Created 1 month ago in toddbluhm/env-cmd with...
Read more >Failed to find .env file at path: .env - Netlify Support Forums
I'm able to leverage the .env file on my local and am able to run my ... refs/heads/staging 9:55:40 AM: Parsing package.json dependencies ......
Read more >env-cmd: Documentation - Openbase
... [path] Custom rc file path (default path: ./.env-cmdrc(|.js|.json) --silent Ignore any env-cmd errors and only fail on executed program failure.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

thanks, in my case I had a trailing comma
its most likely a syntax error for me my env-cmdrc had a comma in the last key value pair in the development section.