suchen

Heim  >  Fragen und Antworten  >  Hauptteil

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

大家讲道理大家讲道理2863 Tage vor598

Antworte allen(3)Ich werde antworten

  • 怪我咯

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

    谢邀 production 不要留空格

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

    直接看输出的什么吧

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

    Antwort
    0
  • 迷茫

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

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

    自己测试通过

    如果不通过,用typeof env把类型打印出来看一下,有可能是 object

    Antwort
    0
  • 怪我咯

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

    把命令里面的set改成export

    export NODE_ENV=production

    你用set命令把空格带进环境变量里去了

    Antwort
    0
  • StornierenAntwort