Wednesday, 24 May 2017

Node Environmental variable on Windows

I noticed this strange behavior which is not a big deal, but bugging the heck out of me.

In my package.json file, under the "scripts" section, I have a "start" entry. It looks like this:

"scripts": {
    "start": "APPLICATION_ENV=development nodemon app.js"
}

typing npm start on a Mac terminal works fine, and nodemon runs the app with the correct APPLICATION_ENV variable as expected. When I try the same on a Windows environment, I get the following error:

"'APPLICATION_ENV' is not recognized as an internal or external command, operable program or batch file."

I have tried the git-bash shell and the normal Win CMD prompt, same deal.

I find this odd, because typing the command directly into the terminal (not going through the package.json script via npm start) works fine.

Has anyone else seen this and found a solution? Thanks!!



via Jason Fingar

No comments:

Post a Comment