I changed the value of NODE_ENV
to production using the command:
setx NODE_ENV production
Now in my nextjs project, anytime I run npm run dev
or build
, I get the error: You are using a non-standard "NODE_ENV" value in you environment.
After doing some research, I found out this property is automatically provided by Nextjs and the default value is NEXT_PUBLIC_APP_ENV
(I may be wrong about this).
I've tried to change the value back to the default: using setx NODE_ENV NEXT_PUBLIC_APP_ENV
which works. Here's the result of running node
followed by process.env
in my terminal to confirm the change.
The problem is I still get the error every time I run npm run build or dev and in any nextjs project on my PC. I'm I missing something or is there another place this property is being added? Please help.
Turns out it was stored in my computer's environment variable. If you're on windows 7/10/11, here's the solution to fix this.
Hold down
Win + R
to open the run box and entersysdm.cpl
to open your system properties.Next, navigate to the advanced tab and click
Environment variables
at the bottom.You should see a list of all the
env
variables stored on your PC. Among the list should be the variable forNODE_ENV
. Simply delete it and click okay to set it to default.