3

I'm trying to setup an environment. However, I'm getting the following error every time:

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

When I added the set before NODE_ENV it showed me only this:

set NODE_ENV=development nodemon -w src --exec "babel-node src --presets es2015,stage-0"
RobC
  • 22,977
  • 20
  • 73
  • 80
TikTak
  • 713
  • 1
  • 11
  • 23
  • The `cross-env` package is helpful for this – vapurrmaid Apr 12 '18 at 11:14
  • Possible duplicate of ["NODE\_ENV" is not recognized as an internal or external command, operable command or batch file](https://stackoverflow.com/questions/11928013/node-env-is-not-recognized-as-an-internal-or-external-command-operable-comman/40967643#40967643) – laggingreflex Jul 02 '19 at 07:08

2 Answers2

5

In package.json please add below line and try,

"build": "SET NODE_ENV=production webpack"

If no luck then add below dependency,

"npm i cross-env"

and in package.json,

"start": "cross-env NODE_ENV=development node server.dev.js", "serve": "cross-env NODE_ENV=production node server.prod.js"
Vijayanath Viswanathan
  • 8,027
  • 3
  • 25
  • 43
3

Sometimes setting SET NODE_ENV=... doesn't solve your issue. Then you should run npm install -g win-node-env

Nagibaba
  • 4,218
  • 1
  • 35
  • 43