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
Latest npm package is not working #115
Comments
Replace env-cmd with ./node_modules/.bin/env-cmd -f |
You should use the following command in your package.json: |
Note that this error can happen if your file is broken. In my case I accidentally forgot to end a line in my .env-cmd.js file with a comma and then it started acting like the file was gone. I think the latest version is swallowing the critical part of the error. Previous version will give something like:
Current version only seems to show the "Unable to locate .rc file" part. |
I confirmed locally, that there is a bug on the latest version |
@alexolivas could you set up an example repo for this? My tests/example repos are showing .rc files working as expected, but I don't have/use You could also try passing the The example tests that I use to test the functionality are located here: https://github.com/toddbluhm/env-cmd-examples/tree/master/examples/rc-file |
@toddbluhm , For nested object it is not working. And output come like, Any idea to fetch the nested objects value ? it is coming as [object object] |
@sadashivm That is correct behavior.
If you want to create a nested object, you can stringify the object yourself like this.
Then you will have to access the nested values like this:
However, if you're saying you want to be able to access the values like this:
then you would need to have those values at the top level of the .env file
At this time I do not plan on adding any advanced nesting features to this project. I certainly could be convinced otherwise, but it would have to be something already standardized and with reasonable/expected behavior. Currently, nesting can be implemented via the solution above without any changes to Hopefully, that helps answer your issue 😄 |
@toddbluhm , |
Closing due to inactivity |
Hi @toddbluhm
I'm using your npm package in react js application. it is not working properly
I used below steps:
Install package locally
npm i env-cmd
In package.json looks like
Created a .env-cmdrc file in the root directory and structure as
Finally updated scripts object in package.json file like
run the below commond
npm start
Got the below error
Please let me know if I've missed out anything.
The text was updated successfully, but these errors were encountered: