Nodejs Error: "NODE_ENV" is not recognized as an internal or external command
I'm a beginner in Nodejs, I'm trying to setup an environment for a Node.js app. But I got an error:
"NODE_ENV" is not recognized as an internal or external command, operable command or batch file.
I installed package win-node-env
by using the command:
npm install -g win-node-env
I'm using Windows and also tried set NODE_ENV=development
but it's still not working.
How can I resolve it?
-
J1
Jair Rojas Garcia Jun 04 2021
It sounds like your error comes from an attempt to run something like this (which works in Linux)
NODE_ENV=development node index.js
the equivalent in Windows would be
SET NODE_ENV=development node foo.js
running in the same command shell. You mentioned set NODE_ENV did not work, but wasn't clear how/when you executed it.
I hope it works for you!
-
R0
Raja T Jun 04 2021
You can try with windows you can use
&
in between commands also. Like,"scripts": { "start": "SET NODE_ENV=development & nodemon app/app.js", }
And it works for me.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.