#.env.local

45 messages · Page 1 of 1 (latest)

tawny barn
#

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

granite vaporBOT
#

🔎 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)

snow sentinel
#

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

tawny barn
#

I do not know how to create .env.local file. This is what I am asking here.

snow sentinel
#

You know how to create an ordinary, empty file on windows right?

tawny barn
#

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 ?

snow sentinel
#

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

tawny barn
#

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.

dusky sky
tawny barn
#

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 ...

dusky sky
#
touch .env.local
#

@tawny barn I've a question, how did you make page.tsx?

#

wrong ping

tawny barn
#

create-next-app@latest

dusky sky
tawny barn
#

Fallowing Lee's YouTube video

dusky sky
#

use the same step to create .env.local

#

right click at project dir, create .env.local

tawny barn
#

Yes I know how to add ordinary files in vscode/next

#

Thought .env is special

snow sentinel
#

.env.local is LITERALLY an ordinary file...

tawny barn
#

That i need Next to do this

dusky sky
tawny barn
#

Thought Next will do some behind the scenes stuf... with path or smth.

snow sentinel
#

You use the same way of creating page.tsx to create .env.local period

dusky sky
#
npx create-next-app@latest next-app
cd next-app 
touch .env.local
code .env.local
tawny barn
#

Cheers

snow sentinel
#

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

dusky sky
#

Which code editor are you using, I'll share a video recording

tawny barn
#

First time in Discord too...thanks for so pleasant experience.

#

vscode

dusky sky
#

I'll send you a video recording in a min

tawny barn
#

Back in a bit, cigarette

dusky sky
#

to open that dropdown, I right clicked

#

and after typing done in the comment, I deleted .env.local to show you again

tawny barn
#

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

granite vaporBOT
#
✅ 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)

tawny barn
#

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 ...

dusky sky
dusky sky