search

Home  >  Q&A  >  body text

node.js process.env.NODE_ENV 无法判断问题?

大家讲道理大家讲道理2863 days ago599

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-17 15:30:39

    Thanks for the invitation production Do not leave spaces

    "start": "set NODE_ENV=production&& npm run build && node babel/server",

    Just look at the output

    console.log(`+${env}+`, env === "production");

    reply
    0
  • 迷茫

    迷茫2017-04-17 15:30:39

    declare -x NODE_ENV=production && node temp.js
    

    Passed the test myself

    If it does not pass, use typeof env to print out the type and have a look. It may be object

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 15:30:39

    Change the set in the command to export

    export NODE_ENV=production

    You used the set command to bring spaces into environment variables

    reply
    0
  • Cancelreply