Are you currently utilizing an unconventional "NODE_ENV" value within your environment settings? Discover how to easily configure the default value of NODE_ENV in a Windows operating system

Recently, I modified the value of NODE_ENV to production using the command:

setx NODE_ENV production

However, whenever I execute npm run dev or build in my Nextjs project, I encounter an error message saying: You are using a non-standard "NODE_ENV" value in your environment.

https://i.stack.imgur.com/AwvrP.png

Having conducted some investigation, I discovered that this property is automatically inserted by Nextjs with the default value being NEXT_PUBLIC_APP_ENV (though unsure about this).

I attempted reverting back to the default value using

setx NODE_ENV NEXT_PUBLIC_APP_ENV
, which seemed to work. Here's the outcome after running node followed by process.env in my terminal to verify the change.

https://i.stack.imgur.com/s0WvH.jpg

Despite these efforts, I still continue to face the same error message every time I run npm run build or dev in any Nextjs project on my computer. Could it be missing something or might there be another location this property is getting added? Any assistance would be greatly appreciated.

Answer №1

It turns out that the solution to the issue was hiding in my computer's environment variable settings. For those using Windows 7/10/11, here is a simple step-by-step guide to resolve this problem.

To begin, press Win + R simultaneously to open the run dialog box. Once open, type sysdm.cpl and hit enter to access your system properties.

Once in the system properties window, head over to the advanced tab and locate the option for Environment variables at the bottom of the page.

https://i.stack.imgur.com/1ORTD.png

You will now see a list containing all the env variables stored on your computer. One of these should be the variable related to NODE_ENV. Simply remove it from the list and click okay to revert it back to default settings.

Keep in mind that you may need to restart your terminal for the changes to take effect.

https://i.stack.imgur.com/XPevV.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error: The property 'case sensitive routing' cannot be accessed because it is undefined

Task at hand: Running ExpressJS port using Node.js, nodemon, and lib. Operating System: Windows 10 Home x64 Node.JS Version: Lts The Challenge: Getting the ExpressJS port to run successfully. Current Issue: Encountering an internal file error, potentiall ...

Error Encountered: Unhandled Runtime Error in Next.js with Firebase - TypeError: Unable to access the property 'initializeApp' as it is undefined

It's baffling why this error keeps appearing... my suspicion is directed towards this particular file. Specifically, firebaseAuth={getAuth(app)} might be the culprit. Preceding that, const app = initializeApp(firebaseConfig); is declared in "../f ...

What is the best way to bring in styles to a Next.js page?

I am facing an issue with my app where I have a folder called styles containing a file called Home.module.css. Every time I try to include the code in my pages/index.js, I encounter the same error message saying "404 page not found.." import styles from & ...

What is the best method to implement real-time data updates in a single page application

Looking for a solution to update the data in my SPA web app that utilizes next js and express js. How can I ensure the application on computer 1 reflects changes made by computer 2 without requiring a manual refresh? ...

Having trouble establishing a connection to the mlab Database from my local machine

As I attempt to establish a connection between my localhost and the mlab database using node.js, I encounter an issue. The URL I am using is mongodb://username:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff8f9e8c8c88908d9bbf ...

Font experiencing FOUT (Flash Of Unstyled Text) with each page reload

Can anyone help me with this issue I am facing? The first time I load everything, it seems fine. https://i.stack.imgur.com/btkN6.png However, after the first time, I see '(ServiceWorker)' as Size but the FOUT (Flash of Unstyled Text) still happ ...

NodeJS - The server returns a 404 error before ultimately displaying the requested page

I'm having trouble with my nodeJS application. When I make an asynchronous call using ajax, the server first responds with a 404 error before loading the page. The application functions properly, but I keep receiving repetitive logs stating "Can' ...

Resetting memory variables with Node.js: A step-by-step guide

I'm looking to reset all the variables in my Node.js application using the npm package node cron (https://www.npmjs.com/package/node-cron). Specifically, I need help with ensuring that my arrays are cleared out properly. While the package works well ...

Is there a way to display a unique image depending on the user's chosen color scheme?

I am attempting to utilize a next/image instead of a traditional img tag in the code snippet below. Using a regular <img> tag, the following code achieves exactly what I desire: <div> <picture> <source srcSet="https://vi ...

Execute the node server and webpack simultaneously by utilizing the package.json file

I recently finished a todo app project after following along with this informative video: Excellent MEAN Stack Tutorial: Angular, Node/Express, Webpack, MongoDB, SASS, Babel/ES6, Bootstrap In the tutorial, specifically at minute 19:18 on this link, the i ...

Unable to establish a connection between NodeJS and MongoDB Atlas on CentOS server

After successfully creating a cluster on MongoDB Atlas and connecting to it using Compass and Node locally, I encountered an ECONNREFUSED error when trying to run the same code on my CentOS machine. Below is the Node.js code snippet: const MongoClient = r ...

The regular expression functions seamlessly on the Express Route Tester tool, but encountered errors when implemented in a NodeJS environment

I recently utilized Express in a NodeJs project and I needed to create specific routes for my server: /dogs /pinguin /bear /wolf /cat /rat To test these routes, I used a regex tool () : Express Route Tester While the express route tester showed everythin ...

Prevent Dropdown from Triggering Unexpected Jumps

I've incorporated the TextField and MenuItem components from Material-UI into my next.js project. By setting the "select" prop in the TextField, it utilizes the Select component internally. However, I'm facing an issue where the dropdown jumps ...

Enhancing Navigation in NextJS with an Active Navbar

Attempting to apply a style to the active Navbar on NextJs, I have experimented with various approaches. I imported useRouter() from next/navigation It appears that this method is somewhat outdated. <li className='font-medium py-1 my-2&apo ...

Issue with the _.filter function in lodash library when used in a Node.js environment

My goal is to remove rows from a CSV file that already contain email addresses found in Mailchimp. Although I attempted to achieve this with a function, it seems that the number of elements returned is not accurate: async function testDeleteEmails(listID, ...

What is the systematic approach to verify if the npm packages listed in the package.json file are actually being utilized in the

Is there a way to verify that all modules listed in the package.json file of a node project are actively being used within the project itself? Consider a situation where multiple individuals are contributing to the project, continuously adding new npm pac ...

React: detect the key pressed when submitting a form

I am currently working with React in combination with Material UI. My goal is to implement a functionality where the form submission only occurs when I click the Submit button, rather than triggering it by pressing enter while focused on a text field. Her ...

Only the final defined document is instantiated by the Swagger-ui-express module

Currently, I am working on a Typescripted nodejs server and facing an issue with defining different swagger paths for separated controllers. The problem is that the swagger-ui-express module only displays the last defined document in the specific route. I ...

The POST request in Node.js encountered an error due to attempting to set headers after they were already sent to the client, resulting in the following message

After creating REST services using Node JS, Express, and Mongo DB, I encountered a problem with my POST request to add users into the database. When testing the service locally using POSTMAN, the user gets added successfully, but the node app crashes (serv ...

Issue with API showing return value as a single value instead of an array

My database consists of collections for Teachers and Classes. In order to fully understand my issue, it's important to grasp the structure of my database: const TeacherSchema = new Schema( { name: { type: String, required: true } ...