【问题标题】:(dotenv) with NodeJS : Missing config value LDAP_DN(dotenv) 与 NodeJS:缺少配置值 LDAP_DN
【发布时间】:2019-12-09 09:46:20
【问题描述】:

我在 NodeJS 后端使用 dotenv。在我添加新的环境变量之前一切正常 现在,当应用程序在 docker 中启动时出现错误

Cannot start the application. Error: MISSING CONFIG VALUES: LDAP_DN
    at Object.config (/home/node/app/node_modules/dotenv-extended/lib/index.js:71:19)
    at new PrivbackApplication (/home/node/app/src/application.ts:70:15)
    at Object.main (/home/node/app/src/index.ts:7:15)
    at Object.<anonymous> (/home/node/app/index.js:17:15)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

我的配置:

根应用程序文件夹中的 .env.example 配置文件(我添加了 LDAP_DN)

NODE_ENV=
LDAP_DN=
LDAP_PROTOCOL=
LDAP_HOST=
LDAP_PORT=

在 application.ts 中

dotenv.config();
    dotenvExt.load({
      schema: '.env.example',
      errorOnMissing: true,
    });

dotenvExt.load 行错误点

有什么想法吗?

谢谢

劳伦特

【问题讨论】:

    标签: node.js dotenv


    【解决方案1】:

    问题已解决

    我错过了 .env 文件 我在 .env 文件中添加了 LDAP_DN= 现在它可以工作了

    【讨论】:

      猜你喜欢
      • 2013-03-10
      • 2020-03-01
      • 2017-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-20
      • 2019-11-14
      相关资源
      最近更新 更多