Thanks really helped! It also works with tsx when running a typescript file as a script in NextJS. Just add the same command: "tsx --env-file .env.local ${file path}"
Thank you for the tip! I used NVM but it always messed up the packages when I wanted to update the versions. I started using scoop package manager which is awesome, you can use as many node version as you want, it handles their packages very well, it's really easy to update the versions. At work I use 18, 20 LTS and the latest 21. I ended up installing other developer tools like Git by scoop because it's much more easier to update than using a windows installer.
Thank you very useful also the nvm part as I was struggling between my node version with yarn it was always selecting the last one which I didn’t want. Thank you very good features 👍
Still surprises me that this was not in Node since v1, but still, good to finally have it. Kinda wondering why the default behaviour isn't to pick up .env & the flag is only required if you want to using another filename.. i.e that is what dotenv has been doing all these years (though, I actually prefer env-var package, mostly)
A question: This works from command line (and thus in CI) but if I want to run a piece of code (say tests) from an IDE (such as VSCode), what would be required to load the env variables?
This is great thanks! Question I don’t use .env file locally, I add whatever variable I need in windows environment variables (for security reasons, don’t want to commit api keys or whatever by mistake) and simply call them in my apps using dotenv (process.env.someVariable). Is there a way to access these with some other flag such as the one you showed -env-file .env ? Thanks again for video
I have a question. Looking at the folder structure, the .env is inside the the src folder with index.js. When you using the terminal to load the dotevn, is it absolute to write the file that needs the environment variables it in each case ? Or is something to be loaded once and the whole app starts using it ?
Saving environment variables and getting them to work is fairly easy on Netlify but not so easy on cheaper hosting platforms that use cPanel with the Node.js web application feature. This feature allows you to store environment variables. I'm still new to this but haven't had success getting it to work. I think a video on that would be very helpful. @@JamesQQuick
vary help full video now i am using like that in package.json file "scripts": { "start": " nodemon --env-file .env ./index.js" }, any more way to do this then replay me any one 🙋♂🙋♂
@@JamesQQuick I deploy my code at Azure web apps, and I declare my environment variables in the web app, I don't upload any .env file just the dotenv package read the environments automatically. I am not sure whether it will work there or not
@@JamesQQuick I checked everything and now I just want to clear out that I didn't know that I don't need dotenv package if I already setup the environments variables on the cloud, so yeah now I can use what you told in the video easily. Thanks
@@hrushikeshvibhute4639 they were suggestions not previous commands and I just got it working. you can check this out if you want to do it too ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ZhFFs5ltNDs.html
@krtirtho show me a system writed in bun with milions of requests and users that handles tons of data, running in a production environment and qe start talking! Benchmark tests are not enough to replace a consolidated language to another one.
Environment variables have a different use case. They're for private data such as database passwords that you don't want to upload to GitHub by mistake.