javascript - Node.js app - different NODE_ENV when launched by NPM -
i have node.js app. runs in "production" mode when launched npm start , in 'development' mode when launched node start.js. don't understand difference.
how can set 'development' mode according system variable 'npm start'?
inside script log value of node_env way:
console.log(process.env.node_env) my system variable:
d:\>echo %node_env% development my npn content:
... "private": true, "main": "start.js", "scripts": { "start": "node --use_strict start.js", ... the problem:
- when run
node --use_strict start.js- returns: "development" (right) - when run
npm start- returns production (wrong)
(win: 7, npm: 3.8.3, node: v5.10.1)
the solution:
npm config set production=false the npm provides own config register.
hre info: https://docs.npmjs.com/cli/config
Comments
Post a Comment