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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -