我正在按照本教程对快速应用程序的用户进行操作。
我被困在第Running the application
章.
我已经使用$env:myprivatekey = "test"
设置了环境变量
我使用$env:myprivatekey
测试变量
test
问题是
config.get("myprivatekey");
正在提高
throw new Error('Configuration property "' + property + '" is not defined');
^
Error: Configuration property "myprivatekey" is not defined
at Config.get (C:UsersmiskoDocumentsProjectsWeddingSallonnode_modulesconfiglibconfig.js:182:11)
at Object.<anonymous> (C:UsersmiskoDocumentsProjectsWeddingSallonapp.js:6:8)
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
问题出在哪里? 谢谢。
在 default.json 中,你使用了:
{
"myprivatekey": "myprivatekey"
}
但是你必须像这样使用它:
module.exports = {
myprivatekey: "myprivatekey"
};