I want to set some env variable in my node app but when I run this command NODE_ENV=development x=23 nodemon.cmd server.js
then it gives me that error NODE_ENV=development' is not recognized, I found some solution where it said that I have to run a
npm package
npm install -g win-node-env
then it will work, but in my case, I got the same error. I am a windows user, any solution how to fix this.
The term 'NODE_ENV=development' is not recognized as the name of a cmdlet, function, script file, or operable program
6.6k Views Asked by Mohammad Ali Shuvo At
1
This may or may not relevant to your question, but as far as I know, windows powershell syntax does not assign variable that way.
to assign variable in windows, you can subtitute
NODE_ENV=development
with$NODE_ENV:development
As a workaround, and if you want to run it on any OS, use
cross-env
npm package.Now, it can run command such as: