Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"NODE_ENV" is not recognized as an internal or external command, operable command or batch file

I'm trying to setup an environment for a Node.js app. but I'm getting this error every time.

"NODE_ENV" is not recognized as an internal or external command, operable command or batch file.

What does this mean and how can I solve this problem?

I'm using Windows and also tried set NODE_ENV=development but had no luck.

like image 582
krozero Avatar asked Aug 13 '12 03:08

krozero


People also ask

What does NODE_ENV mean?

NODE_ENV is an environment variable that stands for node environment in express server. The NODE_ENV environment variable specifies the environment in which an application is running (usually, development or production).

Can you override NODE_ENV?

You cannot override NODE_ENV manually. This prevents developers from accidentally deploying a slow development build to production.

What is setting NODE_ENV?

Node. js assumes it's always running in a development environment. You can signal Node. js that you are running in production by setting the NODE_ENV=production environment variable. This is usually done by executing the command.


Video Answer


1 Answers

I wrote a module for this: win-node-env.

It creates a NODE_ENV.cmd that sets the NODE_ENV environment variable and spawns a child process with the rest of the command and its args.

Just install it (globally), and run your npm script commands, it should automatically make them work.

npm install -g win-node-env 
like image 152
laggingreflex Avatar answered Sep 20 '22 16:09

laggingreflex