How to create .env.local file in Next.js14+ app. Lee vid "Introduction to Next.js and React" on YouTube at 34:33 Lee creates .env.local file with touch command that he also says works on Mac computers only. How do I create .env.local file on Windows computer? There is no explanation how to create this file in Next.js documentation either. Cheers
#.env.local
45 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
He said Mac only because touch is a Linux (Mac is built on top of Linux, kind of) command used for creating an empty file.
You just use whatever way you already know to create the same file
I do not know how to create .env.local file. This is what I am asking here.
You know how to create an ordinary, empty file on windows right?
I thought there is more to this in .inv.local case. Like I need Next app to do it. Something with path maybe. Why Lee uses touch command and not creating it manually ?
File and folder names that start with a dot are typically considered hidden files by the OS (Windows in your case).
As for using touch, it is properly just because Lee find it more convient
That's literally nothing special about it. That's just a way to create a file
There is 41 second video "How to use a .env file to load environment variables in a dev container" on YouTube. Guy makes devcontainer.env and also devcontainer.json, where he adds some mods. Do i need to do .json also and add those mods.
right click, and create a file .env.local
Thanks Mwskwong . I will keep pushing again tomorrow morning. Too stressed up now. Did not get to anywhere today. Trying to log into Discord took an effort ...
create-next-app@latest
no, like if you try to create a route like /contact
Fallowing Lee's YouTube video
.env.local is LITERALLY an ordinary file...
That i need Next to do this
...
Thought Next will do some behind the scenes stuf... with path or smth.
You use the same way of creating page.tsx to create .env.local period
npx create-next-app@latest next-app
cd next-app
touch .env.local
code .env.local
Cheers
No offense, but maybe Next.js is too early for you.
.env* has nothing to do with Next.js alone, it is a common file naming convention for specifying environment variables
Which code editor are you using, I'll share a video recording
I'll send you a video recording in a min
Back in a bit, cigarette
@tawny barn
to open that dropdown, I right clicked
and after typing done in the comment, I deleted .env.local to show you again
Yes see I need to do more than just create .env. that's why I was looking to create .env file like Lee did it, with command.
It's all clear now. Thanks for 5 star help. You are HERO
✅ Success!
This question has been marked as answered! If you have any other questions, feel free to create another post
Jump to answer
[Click here](#1216739712446890014 message)
ln Lee's video there is no env.json file created though ...
And inv.local file is created to public folder, thais can't be right ...
you are not creating env.json
You don't have to right click public folder