require('config') loaded nothing in debugHow do I debug Node.js applications?Understanding Node.js modules: multiple requires return the same object?How do I debug “Error: spawn ENOENT” on node.js?Using Node.js require vs. ES6 import/exportMocha - Test a module with a modification config fileNodejs require configNodeJs : Require is not definedCan I use node-config to load configuration settings from config files created by other libraries such as sequelize-cli?Node-config custom-environment-variables not Picking Docker environment VariablesParse error when config reading the development.json
I caught several of my students plagiarizing. Could it be my fault as a teacher?
Was Hulk present at this funeral?
I lost my Irish passport. Can I travel to Thailand and back from the UK using my US passport?
What happened to Ghost?
How can I close a gap between my fence and my neighbor's that's on his side of the property line?
The barbers paradox first order logic formalization
Is balancing necessary on a full-wheel change?
What are the spoon bit of a spoon and fork bit of a fork called?
How could a planet have most of its water in the atmosphere?
How to creep the reader out with what seems like a normal person?
Was Unix ever a single-user OS?
How to efficiently calculate prefix sum of frequencies of characters in a string?
Entropy as a function of temperature: is temperature well defined?
Airbnb - host wants to reduce rooms, can we get refund?
Map one pandas column using two dictionaries
Is this homebrew race based on the Draco Volans lizard species balanced?
If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?
What happens if I start too many background jobs?
Field Length Validation for Desktop Application which has maximum 1000 characters
If Melisandre foresaw another character closing blue eyes, why did she follow Stannis?
Can commander tax be proliferated?
What word means "to make something obsolete"?
How to back up a running Linode server?
Feels like I am getting dragged into office politics
require('config') loaded nothing in debug
How do I debug Node.js applications?Understanding Node.js modules: multiple requires return the same object?How do I debug “Error: spawn ENOENT” on node.js?Using Node.js require vs. ES6 import/exportMocha - Test a module with a modification config fileNodejs require configNodeJs : Require is not definedCan I use node-config to load configuration settings from config files created by other libraries such as sequelize-cli?Node-config custom-environment-variables not Picking Docker environment VariablesParse error when config reading the development.json
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
My nodejs app config = require('config')
(3.0.1) returns nothing in debug. Here is the console output:
config:
Config
NODE_ENV
is only defined in development.json and loading in development has no problem.
Here is the files under ./config:
What could cause the config module failed to load in debug?
node.js node-config
add a comment |
My nodejs app config = require('config')
(3.0.1) returns nothing in debug. Here is the console output:
config:
Config
NODE_ENV
is only defined in development.json and loading in development has no problem.
Here is the files under ./config:
What could cause the config module failed to load in debug?
node.js node-config
You need an index.js in the config directory. Do you want an exemple of config dir ?
– Julien TASSIN
Mar 22 at 20:27
Julien TASSIN
, an example would be very helpful. Thanks.
– user938363
Mar 22 at 20:42
oh, sorry my bad I did not see that you usednode-config
, I thought you were using pure nodejs. I don't know this lib :/
– Julien TASSIN
Mar 22 at 20:53
add a comment |
My nodejs app config = require('config')
(3.0.1) returns nothing in debug. Here is the console output:
config:
Config
NODE_ENV
is only defined in development.json and loading in development has no problem.
Here is the files under ./config:
What could cause the config module failed to load in debug?
node.js node-config
My nodejs app config = require('config')
(3.0.1) returns nothing in debug. Here is the console output:
config:
Config
NODE_ENV
is only defined in development.json and loading in development has no problem.
Here is the files under ./config:
What could cause the config module failed to load in debug?
node.js node-config
node.js node-config
asked Mar 22 at 20:08
user938363user938363
2,5671466143
2,5671466143
You need an index.js in the config directory. Do you want an exemple of config dir ?
– Julien TASSIN
Mar 22 at 20:27
Julien TASSIN
, an example would be very helpful. Thanks.
– user938363
Mar 22 at 20:42
oh, sorry my bad I did not see that you usednode-config
, I thought you were using pure nodejs. I don't know this lib :/
– Julien TASSIN
Mar 22 at 20:53
add a comment |
You need an index.js in the config directory. Do you want an exemple of config dir ?
– Julien TASSIN
Mar 22 at 20:27
Julien TASSIN
, an example would be very helpful. Thanks.
– user938363
Mar 22 at 20:42
oh, sorry my bad I did not see that you usednode-config
, I thought you were using pure nodejs. I don't know this lib :/
– Julien TASSIN
Mar 22 at 20:53
You need an index.js in the config directory. Do you want an exemple of config dir ?
– Julien TASSIN
Mar 22 at 20:27
You need an index.js in the config directory. Do you want an exemple of config dir ?
– Julien TASSIN
Mar 22 at 20:27
Julien TASSIN
, an example would be very helpful. Thanks.– user938363
Mar 22 at 20:42
Julien TASSIN
, an example would be very helpful. Thanks.– user938363
Mar 22 at 20:42
oh, sorry my bad I did not see that you used
node-config
, I thought you were using pure nodejs. I don't know this lib :/– Julien TASSIN
Mar 22 at 20:53
oh, sorry my bad I did not see that you used
node-config
, I thought you were using pure nodejs. I don't know this lib :/– Julien TASSIN
Mar 22 at 20:53
add a comment |
1 Answer
1
active
oldest
votes
The config filenames need to be tied to the NODE_ENV or NODE_CONFIG_ENV you're setting when you run your app. (https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-load-order)
You don't set NODE_ENV in the config files themselves.
So for example (assuming the command to run your app is npm start
):
NODE_CONFIG_ENV=foo npm start
^ This would first load all of the config properties in default.json
, then override them with any properties you set in foo.json
. If you wanted to add a local.json
, those properties would be a final override.
I believe it defaults to assuming your env is "development", and I'm guessing your default.json is empty.
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307109%2frequireconfig-loaded-nothing-in-debug%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The config filenames need to be tied to the NODE_ENV or NODE_CONFIG_ENV you're setting when you run your app. (https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-load-order)
You don't set NODE_ENV in the config files themselves.
So for example (assuming the command to run your app is npm start
):
NODE_CONFIG_ENV=foo npm start
^ This would first load all of the config properties in default.json
, then override them with any properties you set in foo.json
. If you wanted to add a local.json
, those properties would be a final override.
I believe it defaults to assuming your env is "development", and I'm guessing your default.json is empty.
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
add a comment |
The config filenames need to be tied to the NODE_ENV or NODE_CONFIG_ENV you're setting when you run your app. (https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-load-order)
You don't set NODE_ENV in the config files themselves.
So for example (assuming the command to run your app is npm start
):
NODE_CONFIG_ENV=foo npm start
^ This would first load all of the config properties in default.json
, then override them with any properties you set in foo.json
. If you wanted to add a local.json
, those properties would be a final override.
I believe it defaults to assuming your env is "development", and I'm guessing your default.json is empty.
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
add a comment |
The config filenames need to be tied to the NODE_ENV or NODE_CONFIG_ENV you're setting when you run your app. (https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-load-order)
You don't set NODE_ENV in the config files themselves.
So for example (assuming the command to run your app is npm start
):
NODE_CONFIG_ENV=foo npm start
^ This would first load all of the config properties in default.json
, then override them with any properties you set in foo.json
. If you wanted to add a local.json
, those properties would be a final override.
I believe it defaults to assuming your env is "development", and I'm guessing your default.json is empty.
The config filenames need to be tied to the NODE_ENV or NODE_CONFIG_ENV you're setting when you run your app. (https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-load-order)
You don't set NODE_ENV in the config files themselves.
So for example (assuming the command to run your app is npm start
):
NODE_CONFIG_ENV=foo npm start
^ This would first load all of the config properties in default.json
, then override them with any properties you set in foo.json
. If you wanted to add a local.json
, those properties would be a final override.
I believe it defaults to assuming your env is "development", and I'm guessing your default.json is empty.
answered Mar 23 at 7:28
Ben ChamberlinBen Chamberlin
514212
514212
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
add a comment |
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
All setting goes to the default.json as well. The issue is the the config is loaded successfully in normal development (for ex, when node index.js) but not in debug with VS code. I posted on VS code to find out if this is something related to the IDE.
– user938363
Mar 23 at 18:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307109%2frequireconfig-loaded-nothing-in-debug%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need an index.js in the config directory. Do you want an exemple of config dir ?
– Julien TASSIN
Mar 22 at 20:27
Julien TASSIN
, an example would be very helpful. Thanks.– user938363
Mar 22 at 20:42
oh, sorry my bad I did not see that you used
node-config
, I thought you were using pure nodejs. I don't know this lib :/– Julien TASSIN
Mar 22 at 20:53