node.js - 在配置目录中找不到配置。主要问题是我无法更改目录
问题描述
const express = require("express");
const app = express();
const config = require('config');
console.log('application name :' + config.get('name'));
我已经尝试过这种方法,但错误总是相同的。
process.env["NODE_CONFIG_DIR"] = "C:\Users\ghana\Desktop\Node\express-demo\config";
这是我得到的错误。
WARNING: No configurations found in configuration directory:/express-demo/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
C:\Users\ghana\Desktop\Node\node_modules\config\lib\config.js:182
throw new Error('Configuration property "' + property + '" is not defined');
解决方案
推荐阅读
- javascript - 如何将对象数组转换为逗号分隔的字符串?
- google-apps-script - 关于单元格选择
- c++ - 如何使用终端命令从 C++ 程序中打开多个图像?
- javascript - 将范围滑块绑定到图像序列
- angular - 在反应式表单模块的 auditTime 方法的订阅块中测试值
- php - 连接两个 MySQL 表并在表中显示结果
- spring-boot - 自定义 AOP Spring Boot 注解
- mysql - MySQL 创建更新触发器时出错
- uber-api - Uber-api 创建用户请求并为同一用户预订多个游乐设施
- django - 在 django-filter 的 numericFilter 中添加选项