process.env NEXT_PUBLIC_ env variables undefined in browser
Answered
Cape lion posted this in #help-forum
Cape lionOP
Expected behavior: After adding NEXT_PUBLIC_ environment variables to the .env.local and starting next with
Result: process.env is undefined (and none of the variables are available).
Environment details:
Next 14.0.4
Node 20.18.0
How do I resolve this?
npx next start
, the NEXT_PUBLIC_ environment variables should be available in the browser.Result: process.env is undefined (and none of the variables are available).
Environment details:
Next 14.0.4
Node 20.18.0
How do I resolve this?
1 Reply
Asian black bear
You need to
next build
before you next start
.Answer