APP_ENV' is not recognized as an internal or external command, operable program or batch file

Viewed 19

I'm trying to run this nodeJs file which I got from my new company as their existing project. from the start script, I tried npm run start-local and got an error that 'APP_ENV' is not recognized as an internal or external command, operable program, or batch file. On googling found out it may be because environmental variables are not set, but I have already given the path of NodeJS as an environmental variable. Tried to run this on the work and personnel computers, but getting the same error. Even though I have installed nodemon, still the error remains the same. is it a sign that I have to add nodemon as an environmental variable too, if yes, please tell me how to do it, thanks. Also, would like to mention that it did worked on senior software devs pcs .

"scripts": {
    "start": "node app.js",
    "start-local": "APP_ENV=local nodemon app.js",  

  • complete error is given below

    *companyName-api@1.0.0 start-local

    APP_ENV=local nodemon app.js 'APP_ENV' is not recognized as an internal or external command, operable program or batch file.*

1 Answers

I'm guessing you're running Windows? Windows doesn't allow you to set envs like that. Install cross-env then do cross-env APP_ENV=local nodemon app.js.

Related