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;








0















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:



enter image description here



What could cause the config module failed to load in debug?










share|improve this question






















  • 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

















0















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:



enter image description here



What could cause the config module failed to load in debug?










share|improve this question






















  • 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













0












0








0








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:



enter image description here



What could cause the config module failed to load in debug?










share|improve this question














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:



enter image description here



What could cause the config module failed to load in debug?







node.js node-config






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 used node-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











  • 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
















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












1 Answer
1






active

oldest

votes


















1














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.






share|improve this answer























  • 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












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
);



);













draft saved

draft discarded


















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









1














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.






share|improve this answer























  • 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
















1














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.






share|improve this answer























  • 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














1












1








1







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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


















  • 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




















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript