Comments (7)
Thanks for the info, this helps a ton. I will try to get around to fixing it, this week and then release this upcoming the weekend.
from env-cmd.
Yeah, thanks for bringing this up. I thought I had absolute pathing working, but apparently not. I will look into this.
from env-cmd.
Hey so I was just looking into this briefly, and could you give me more specifics about case. I was just checking my test cases because I was sure I had this covered and I do have absolute paths covered, but maybe I am missing an edge case.
What OS are you using? (windows, mac, linux, solaris 😉)
What shell are you using? (bash, powershell, zsh, etc..)
What does the full env-cmd
command look like that you are trying to use?
What does the command look like that you are executing on the shell prompt? nuxt start
?
Hopefully, the answers to those questions will help me diagnose this further.
from env-cmd.
Heya,
Just reconfirmed locally using bash on ubuntu 16.04:
-
node_modules/.bin/env-cmd /etc/testymctest.env yarn start
=> variables do not load -
node_modules/.bin/env-cmd testymctest.env yarn start
=> variables load as expected (such a great utility, thanks for sharing btw)
Setting the server port with PORT=3333
in the env file is great for testing because you get instant feedback when nuxt starts as it prints OPEN http://localhost:3333
when its parsed the variables successfully.
Hope that helps. I've already settled for using a local env file for now but this fix would be handy for future projects.
from env-cmd.
@jonnyparris So I was just messing around with a similar setup on my mac and realized that the /etc
folder files (at least on mac) usually have more strict permissions than normal files. I was able to get absolute pathing working out of my /etc
directory, but I had to make sure the permissions of the env file had the r
(read) flag set for all of them (owner, group, others). Could you check your permissions and see if that is the issue?
from env-cmd.
sorry dude I'm not on that project anymore but absolute paths do seem to work on mac fwiw
from env-cmd.
So I finally found time to boot up my linux vm. Ran everything exactly as was stated node_modules/.bin/env-cmd /etc/testymctest.env yarn start
using PORT=3333
in the env file and it all worked great. It printed out 3333
from process.env.PORT
.
At this point, I feel like I have spent enough time debugging this. I think the issue comes down to permissions and that the /etc
folder files can have weird permissions sometimes. If someone can figure out an easily reproducible way to show this bug exists, I will be happy to revisit it.
@jonnyparris Thanks again for the bug report. I am sorry I was unable to reproduce it. Closing for now, but anyone is welcome to comment if they figure it out.
from env-cmd.
Related Issues (20)
- After build how to change .env file value? its possible to inject the value in proudction build without rebulding?
- env-cmd crashes HOT 1
- Is it possible to use env-cmd with docker?
- .env-cmdrc syntax error but prompts 'Error: Failed to find .rc file at default paths' HOT 1
- env-cmd -x is not working on Windows HOT 1
- .env-cmdrc return an error while working with Docker run command HOT 1
- Failed to find .env file if options are not in correct order
- Concatenation not working HOT 3
- Using -f is not using a local file, throwing error. HOT 3
- fails to run 'nyc mocha'
- Add a SetEnvVars API method
- dollar sign substitution is not working if the .env file is located in a custom path
- the function of _terminateProcess returns abnormal value
- Windows Git Bash + zsh without WSL
- Better errors if the JSON file is invalid
- Allow setting default env files locations
- How to launch app into launch.json
- This is driving me crazy: Error: Failed to find .env file at path: ./devOps/env/env.js HOT 5
- Looking for help maintaining project
- `environments` and `file` options may be mutually exclusive
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from env-cmd.