【发布时间】:2021-04-04 03:14:32
【问题描述】:
当我通过 NodeJS 终端运行我的 index.js 文件时,我不断收到此错误消息。我的编辑器是 VS Code。我在 Windows 上。
我将 npm 配置模块加载到我的 index.js 文件中。我创建了一个自定义环境变量.json。我在节点终端中设置了密码 vidlyPrivateKey。我不知道为什么会这样。任何帮助将不胜感激!
这是我的 index.js 代码:
const config = require('config');
try {
const myKey = config.get("jwtPrivateKey");
debug(myKey);
} catch (error) {
debug(error, "FATAL ERROR: jwtPrivateKey is not defined.");
return process.exit(1);
}
自定义环境变量.json:
{
"jwtPrivateKey": "vidlyPrivateKey"
}
【问题讨论】: