appy icon indicating copy to clipboard operation
appy copied to clipboard

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

Open nosizejosh opened this issue 7 years ago • 6 comments
trafficstars

the back-end will not run on Windows, after following all the steps due to the error

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

only way to get back-end to run is to edit the script source in package.json to

"scripts": { "start": "npm run start:local", "start:local": "SET NODE_ENV=local & nodemon index.js", "start:dev": "SET NODE_ENV=development & nodemon index.js", "start:prod": "SET NODE_ENV=production & node index.js", "test": "jest --coverage", "seed": "node scripts/seed.js", "update-permissions": "node scripts/update-permissions.js", "precommit": "lint-staged", "lint": "eslint --fix **/*.js ./" },

as explained here

nosizejosh avatar Oct 21 '18 13:10 nosizejosh

@nosizejosh would you mind testing this module to see if it works for you (with the original script command)?

JKHeadley avatar Oct 21 '18 20:10 JKHeadley

@JKHeadley which module?

nosizejosh avatar Oct 21 '18 22:10 nosizejosh

@nosizejosh sorry, forgot to link it: https://github.com/laggingreflex/win-node-env

JKHeadley avatar Oct 21 '18 22:10 JKHeadley

saw this while trying to troubleshoot, knew it would work but didn't want to just fix without reporting, also my fix was actually to place it as dependency in packages.json

nosizejosh avatar Oct 21 '18 23:10 nosizejosh

trying to create a pull request with below but its too much to clone the whole repo just for this small change. Adding the win-node-env does work as I suspected. I however added as a dependency instead of install globally.

"dependencies": { "aws-sdk": "^2.175.0", "bcryptjs": "^2.4.0", "bell": "^9.3.0", "boom": "^7.2.0", "chalk": "*", "confidence": "^3.0.2", "dotenv": "^2.0.0", "faker": "^4.1.0", "glue": "^5.0.0", "handlebars": "^4.0.6", "hapi-auth-jwt2": "salzhrani/hapi-auth-jwt2#v-17", "imagemagick": "^0.1.3", "iplocation": "^5.0.0", "joi": "^13.3.0", "jsonwebtoken": "^7.1.9", "lodash": "~3.10.1", "lodash-pickdeep": "^1.0.2", "mongoose": "5.0.9", "nes": "^8.1.0", "node-uuid": "^1.4.7", "nodemailer": "^2.6.4", "nodemailer-markdown": "^1.0.1", "owasp-password-strength-test": "^1.3.0", "password-generator": "^2.2.0", "q": "^1.4.1", "request-promise": "^4.2.2", "require-dir": "^0.3.2", "rest-hapi": "^1.2.0", "useragent": "^2.3.0", "zxcvbn": "^4.4.2", "win-node-env": "^0.3.0" },

nosizejosh avatar Oct 21 '18 23:10 nosizejosh

Lol it's been like six years but if anyone is still stuck on this check this link

le-incroyable1-dev avatar Feb 17 '24 18:02 le-incroyable1-dev