Parse error when config reading the development.json2019 Community Moderator ElectionHow to decide when to use Node.js?Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (64)Error: Route.get() requires a callback function but got a [object Undefined] NODE.JS + SQLTypeError [ERR_INVALID_ARG_TYPE]: The “listener” argument must be of type FunctionWhen i started app getting “Unknown keystone list” Error In Keystone 4.0NodeJS-Electron-msnodesqlv8 - Error while loading binaries in msnodesqlv8Chrome browser failed to launch in selenium-nodejs npmError creating database in sequelize Dialect needs to be explicitly supplied as of v4.0.0Levee, circuit breaker pattern, throwing an exception when it is executed
What options are left, if Britain cannot decide?
How to create the Curved texte?
Are all passive ability checks floors for active ability checks?
Why doesn't the EU now just force the UK to choose between referendum and no-deal?
Life insurance that covers only simultaneous/dual deaths
How to simplify this time periods definition interface?
A Cautionary Suggestion
Is a party consisting of only a bard, a cleric, and a warlock functional long-term?
What is the significance behind "40 days" that often appears in the Bible?
Did Ender ever learn that he killed Stilson and/or Bonzo?
PTIJ: Who should I vote for? (21st Knesset Edition)
In a future war, an old lady is trying to raise a boy but one of the weapons has made everyone deaf
Is it normal that my co-workers at a fitness company criticize my food choices?
Opacity of an object in 2.8
Why does Bach not break the rules here?
Is it possible to upcast ritual spells?
Why Choose Less Effective Armour Types?
Official degrees of earth’s rotation per day
Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?
What's the meaning of “spike” in the context of “adrenaline spike”?
How to terminate ping <dest> &
Do I need to be arrogant to get ahead?
How to change two letters closest to a string and one letter immediately after a string using notepad++
My adviser wants to be the first author
Parse error when config reading the development.json
2019 Community Moderator ElectionHow to decide when to use Node.js?Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (64)Error: Route.get() requires a callback function but got a [object Undefined] NODE.JS + SQLTypeError [ERR_INVALID_ARG_TYPE]: The “listener” argument must be of type FunctionWhen i started app getting “Unknown keystone list” Error In Keystone 4.0NodeJS-Electron-msnodesqlv8 - Error while loading binaries in msnodesqlv8Chrome browser failed to launch in selenium-nodejs npmError creating database in sequelize Dialect needs to be explicitly supplied as of v4.0.0Levee, circuit breaker pattern, throwing an exception when it is executed
The config module is required in the index.js as this:
const config = require("config");
But it throws an error when starting nodejs app with nodemon index.js
.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838
throw new Error("Cannot parse config file: '" + fullFilename + "': " + e3);
^
Error: Cannot parse config file: 'C:dcodejsemps_backendconfigdevelopment.json': SyntaxError: Unexpected token } in JSON at position 45
at Config.util.parseFile (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838:11)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:600:28
at Array.forEach (<anonymous>)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:596:14
at Array.forEach (<anonymous>)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:595:13)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
The development.json
is very simple:
"PORT":3000,
"DB_PASSWORD":"password"
If the content of the development.json
is removed and becomes , config throws another error.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194
throw Error(msg);
^
Error: Illegal key type for substitution map at : number
at _substituteVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194:15)
at Config.util.substituteDeep (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1199:3)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1219:43
at Array.forEach (<anonymous>)
at Config.util.getCustomEnvVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1215:12)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:653:28)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Here is the package.json
:
"name": "emps_backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts":
"test": "jest --watchAll --verbose "
,
"author": "",
"license": "ISC",
"dependencies":
"config": "^3.0.1",
"cors": "^2.8.5",
"ejs": "^2.6.1",
"express": "^4.16.4",
"express-async-errors": "^3.1.1",
"joi": "^14.3.1",
"jsonwebtoken": "^8.4.0",
"moment": "^2.24.0",
"nexmo": "^2.4.1",
"nodemon": "^1.18.9",
"pg": "^7.8.0",
"pg-hstore": "^2.3.2",
"randomstring": "^1.1.5",
"sequelize": "^4.42.0",
"socketio": "^1.0.0",
"winston": "^3.2.1"
,
"devDependencies":
"jest": "^24.1.0",
"postman": "^0.2.0",
"supertest": "^3.4.2"
What causes the error? config
should be very easy to use.
node.js node-config
|
show 2 more comments
The config module is required in the index.js as this:
const config = require("config");
But it throws an error when starting nodejs app with nodemon index.js
.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838
throw new Error("Cannot parse config file: '" + fullFilename + "': " + e3);
^
Error: Cannot parse config file: 'C:dcodejsemps_backendconfigdevelopment.json': SyntaxError: Unexpected token } in JSON at position 45
at Config.util.parseFile (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838:11)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:600:28
at Array.forEach (<anonymous>)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:596:14
at Array.forEach (<anonymous>)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:595:13)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
The development.json
is very simple:
"PORT":3000,
"DB_PASSWORD":"password"
If the content of the development.json
is removed and becomes , config throws another error.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194
throw Error(msg);
^
Error: Illegal key type for substitution map at : number
at _substituteVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194:15)
at Config.util.substituteDeep (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1199:3)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1219:43
at Array.forEach (<anonymous>)
at Config.util.getCustomEnvVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1215:12)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:653:28)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Here is the package.json
:
"name": "emps_backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts":
"test": "jest --watchAll --verbose "
,
"author": "",
"license": "ISC",
"dependencies":
"config": "^3.0.1",
"cors": "^2.8.5",
"ejs": "^2.6.1",
"express": "^4.16.4",
"express-async-errors": "^3.1.1",
"joi": "^14.3.1",
"jsonwebtoken": "^8.4.0",
"moment": "^2.24.0",
"nexmo": "^2.4.1",
"nodemon": "^1.18.9",
"pg": "^7.8.0",
"pg-hstore": "^2.3.2",
"randomstring": "^1.1.5",
"sequelize": "^4.42.0",
"socketio": "^1.0.0",
"winston": "^3.2.1"
,
"devDependencies":
"jest": "^24.1.0",
"postman": "^0.2.0",
"supertest": "^3.4.2"
What causes the error? config
should be very easy to use.
node.js node-config
can you add relevant part of theindex.js
file.
– Aritra Chakraborty
Mar 6 at 19:56
It is required in index.jsconst config = require("config");
– user938363
Mar 6 at 19:58
unfortunately could not reproduce the issue using exact circumstance. I think your best bet is deleting node_modules and installing again.
– Aritra Chakraborty
Mar 6 at 20:07
try specific path ofdevelopment.json
inrequire('./development.json');
– Shadab Ahmed
Mar 6 at 20:09
Aritra Chakraborty
, did you mean deleting all modules under node-modules? Or just module config.
– user938363
Mar 6 at 20:10
|
show 2 more comments
The config module is required in the index.js as this:
const config = require("config");
But it throws an error when starting nodejs app with nodemon index.js
.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838
throw new Error("Cannot parse config file: '" + fullFilename + "': " + e3);
^
Error: Cannot parse config file: 'C:dcodejsemps_backendconfigdevelopment.json': SyntaxError: Unexpected token } in JSON at position 45
at Config.util.parseFile (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838:11)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:600:28
at Array.forEach (<anonymous>)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:596:14
at Array.forEach (<anonymous>)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:595:13)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
The development.json
is very simple:
"PORT":3000,
"DB_PASSWORD":"password"
If the content of the development.json
is removed and becomes , config throws another error.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194
throw Error(msg);
^
Error: Illegal key type for substitution map at : number
at _substituteVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194:15)
at Config.util.substituteDeep (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1199:3)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1219:43
at Array.forEach (<anonymous>)
at Config.util.getCustomEnvVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1215:12)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:653:28)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Here is the package.json
:
"name": "emps_backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts":
"test": "jest --watchAll --verbose "
,
"author": "",
"license": "ISC",
"dependencies":
"config": "^3.0.1",
"cors": "^2.8.5",
"ejs": "^2.6.1",
"express": "^4.16.4",
"express-async-errors": "^3.1.1",
"joi": "^14.3.1",
"jsonwebtoken": "^8.4.0",
"moment": "^2.24.0",
"nexmo": "^2.4.1",
"nodemon": "^1.18.9",
"pg": "^7.8.0",
"pg-hstore": "^2.3.2",
"randomstring": "^1.1.5",
"sequelize": "^4.42.0",
"socketio": "^1.0.0",
"winston": "^3.2.1"
,
"devDependencies":
"jest": "^24.1.0",
"postman": "^0.2.0",
"supertest": "^3.4.2"
What causes the error? config
should be very easy to use.
node.js node-config
The config module is required in the index.js as this:
const config = require("config");
But it throws an error when starting nodejs app with nodemon index.js
.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838
throw new Error("Cannot parse config file: '" + fullFilename + "': " + e3);
^
Error: Cannot parse config file: 'C:dcodejsemps_backendconfigdevelopment.json': SyntaxError: Unexpected token } in JSON at position 45
at Config.util.parseFile (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:838:11)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:600:28
at Array.forEach (<anonymous>)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:596:14
at Array.forEach (<anonymous>)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:595:13)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
The development.json
is very simple:
"PORT":3000,
"DB_PASSWORD":"password"
If the content of the development.json
is removed and becomes , config throws another error.
C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194
throw Error(msg);
^
Error: Illegal key type for substitution map at : number
at _substituteVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1194:15)
at Config.util.substituteDeep (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1199:3)
at C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1219:43
at Array.forEach (<anonymous>)
at Config.util.getCustomEnvVars (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1215:12)
at Config.util.loadFileConfigs (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:653:28)
at new Config (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:136:27)
at Object.<anonymous> (C:dcodejsemps_backendnode_modulesconfiglibconfig.js:1643:31)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Here is the package.json
:
"name": "emps_backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts":
"test": "jest --watchAll --verbose "
,
"author": "",
"license": "ISC",
"dependencies":
"config": "^3.0.1",
"cors": "^2.8.5",
"ejs": "^2.6.1",
"express": "^4.16.4",
"express-async-errors": "^3.1.1",
"joi": "^14.3.1",
"jsonwebtoken": "^8.4.0",
"moment": "^2.24.0",
"nexmo": "^2.4.1",
"nodemon": "^1.18.9",
"pg": "^7.8.0",
"pg-hstore": "^2.3.2",
"randomstring": "^1.1.5",
"sequelize": "^4.42.0",
"socketio": "^1.0.0",
"winston": "^3.2.1"
,
"devDependencies":
"jest": "^24.1.0",
"postman": "^0.2.0",
"supertest": "^3.4.2"
What causes the error? config
should be very easy to use.
node.js node-config
node.js node-config
edited Mar 6 at 21:37
user938363
asked Mar 6 at 19:46
user938363user938363
2,5121465139
2,5121465139
can you add relevant part of theindex.js
file.
– Aritra Chakraborty
Mar 6 at 19:56
It is required in index.jsconst config = require("config");
– user938363
Mar 6 at 19:58
unfortunately could not reproduce the issue using exact circumstance. I think your best bet is deleting node_modules and installing again.
– Aritra Chakraborty
Mar 6 at 20:07
try specific path ofdevelopment.json
inrequire('./development.json');
– Shadab Ahmed
Mar 6 at 20:09
Aritra Chakraborty
, did you mean deleting all modules under node-modules? Or just module config.
– user938363
Mar 6 at 20:10
|
show 2 more comments
can you add relevant part of theindex.js
file.
– Aritra Chakraborty
Mar 6 at 19:56
It is required in index.jsconst config = require("config");
– user938363
Mar 6 at 19:58
unfortunately could not reproduce the issue using exact circumstance. I think your best bet is deleting node_modules and installing again.
– Aritra Chakraborty
Mar 6 at 20:07
try specific path ofdevelopment.json
inrequire('./development.json');
– Shadab Ahmed
Mar 6 at 20:09
Aritra Chakraborty
, did you mean deleting all modules under node-modules? Or just module config.
– user938363
Mar 6 at 20:10
can you add relevant part of the
index.js
file.– Aritra Chakraborty
Mar 6 at 19:56
can you add relevant part of the
index.js
file.– Aritra Chakraborty
Mar 6 at 19:56
It is required in index.js
const config = require("config");
– user938363
Mar 6 at 19:58
It is required in index.js
const config = require("config");
– user938363
Mar 6 at 19:58
unfortunately could not reproduce the issue using exact circumstance. I think your best bet is deleting node_modules and installing again.
– Aritra Chakraborty
Mar 6 at 20:07
unfortunately could not reproduce the issue using exact circumstance. I think your best bet is deleting node_modules and installing again.
– Aritra Chakraborty
Mar 6 at 20:07
try specific path of
development.json
in require('./development.json');
– Shadab Ahmed
Mar 6 at 20:09
try specific path of
development.json
in require('./development.json');
– Shadab Ahmed
Mar 6 at 20:09
Aritra Chakraborty
, did you mean deleting all modules under node-modules? Or just module config.– user938363
Mar 6 at 20:10
Aritra Chakraborty
, did you mean deleting all modules under node-modules? Or just module config.– user938363
Mar 6 at 20:10
|
show 2 more comments
1 Answer
1
active
oldest
votes
From config’s documentation:
Files in the config directory are loaded in the following order:
default.EXT
default-instance.EXT
deployment.EXT
deployment-instance.EXT
short_hostname.EXT
short_hostname-instance.EXT
short_hostname-deployment.EXT
short_hostname-deployment-instance.EXT
full_hostname.EXT
full_hostname-instance.EXT
full_hostname-deployment.EXT
full_hostname-deployment-instance.EXT
local.EXT
local-instance.EXT
local-deployment.EXT
local-deployment-instance.EXT
(Finally, custom environment variables can override all files)
Where
• EXT can be .yml, .yaml, .xml, .coffee, .cson, .properties, .json, .json5, .hjson, .ts or .js depending on the format you prefer (see below)
• instance is an optional instance name string for Multi-Instance Deployments
• short_hostname is your server name up to the first dot, from the $HOST or $HOSTNAME environment variable or os.hostname() (in that order). For example if your hostname is www.example.com then it would load www.EXT.
• full_hostname is your whole server name, you may use this when short_hostname collides with other machines.
• deployment is the deployment name, from the $NODE_ENV (or if specified, $NODE_CONFIG_ENV) environment variable
The default.EXT file is designed to contain all configuration parameters from which other files may overwrite. Overwriting is done on a parameter by parameter basis, so subsequent files contain only the parameters unique for that override.
hostname and deployment files allow you to tune configurations for a particular server or deployment. These files are designed to live along with other files in your version control system.
As I am on the phone, I could not check if it is working, but I guess it must be an issue with the filename. Try to use default.json
instead development.json
.
renamed todefault.json
and has the same error. Trieddeployment.json
and same error. The error is sticky.
– user938363
Mar 7 at 3:28
The error disappears after renamingcustom-environment-variables.json
todefault.json
underroot/config/
– user938363
Mar 7 at 5:02
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%2f55031087%2fparse-error-when-config-reading-the-development-json%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
From config’s documentation:
Files in the config directory are loaded in the following order:
default.EXT
default-instance.EXT
deployment.EXT
deployment-instance.EXT
short_hostname.EXT
short_hostname-instance.EXT
short_hostname-deployment.EXT
short_hostname-deployment-instance.EXT
full_hostname.EXT
full_hostname-instance.EXT
full_hostname-deployment.EXT
full_hostname-deployment-instance.EXT
local.EXT
local-instance.EXT
local-deployment.EXT
local-deployment-instance.EXT
(Finally, custom environment variables can override all files)
Where
• EXT can be .yml, .yaml, .xml, .coffee, .cson, .properties, .json, .json5, .hjson, .ts or .js depending on the format you prefer (see below)
• instance is an optional instance name string for Multi-Instance Deployments
• short_hostname is your server name up to the first dot, from the $HOST or $HOSTNAME environment variable or os.hostname() (in that order). For example if your hostname is www.example.com then it would load www.EXT.
• full_hostname is your whole server name, you may use this when short_hostname collides with other machines.
• deployment is the deployment name, from the $NODE_ENV (or if specified, $NODE_CONFIG_ENV) environment variable
The default.EXT file is designed to contain all configuration parameters from which other files may overwrite. Overwriting is done on a parameter by parameter basis, so subsequent files contain only the parameters unique for that override.
hostname and deployment files allow you to tune configurations for a particular server or deployment. These files are designed to live along with other files in your version control system.
As I am on the phone, I could not check if it is working, but I guess it must be an issue with the filename. Try to use default.json
instead development.json
.
renamed todefault.json
and has the same error. Trieddeployment.json
and same error. The error is sticky.
– user938363
Mar 7 at 3:28
The error disappears after renamingcustom-environment-variables.json
todefault.json
underroot/config/
– user938363
Mar 7 at 5:02
add a comment |
From config’s documentation:
Files in the config directory are loaded in the following order:
default.EXT
default-instance.EXT
deployment.EXT
deployment-instance.EXT
short_hostname.EXT
short_hostname-instance.EXT
short_hostname-deployment.EXT
short_hostname-deployment-instance.EXT
full_hostname.EXT
full_hostname-instance.EXT
full_hostname-deployment.EXT
full_hostname-deployment-instance.EXT
local.EXT
local-instance.EXT
local-deployment.EXT
local-deployment-instance.EXT
(Finally, custom environment variables can override all files)
Where
• EXT can be .yml, .yaml, .xml, .coffee, .cson, .properties, .json, .json5, .hjson, .ts or .js depending on the format you prefer (see below)
• instance is an optional instance name string for Multi-Instance Deployments
• short_hostname is your server name up to the first dot, from the $HOST or $HOSTNAME environment variable or os.hostname() (in that order). For example if your hostname is www.example.com then it would load www.EXT.
• full_hostname is your whole server name, you may use this when short_hostname collides with other machines.
• deployment is the deployment name, from the $NODE_ENV (or if specified, $NODE_CONFIG_ENV) environment variable
The default.EXT file is designed to contain all configuration parameters from which other files may overwrite. Overwriting is done on a parameter by parameter basis, so subsequent files contain only the parameters unique for that override.
hostname and deployment files allow you to tune configurations for a particular server or deployment. These files are designed to live along with other files in your version control system.
As I am on the phone, I could not check if it is working, but I guess it must be an issue with the filename. Try to use default.json
instead development.json
.
renamed todefault.json
and has the same error. Trieddeployment.json
and same error. The error is sticky.
– user938363
Mar 7 at 3:28
The error disappears after renamingcustom-environment-variables.json
todefault.json
underroot/config/
– user938363
Mar 7 at 5:02
add a comment |
From config’s documentation:
Files in the config directory are loaded in the following order:
default.EXT
default-instance.EXT
deployment.EXT
deployment-instance.EXT
short_hostname.EXT
short_hostname-instance.EXT
short_hostname-deployment.EXT
short_hostname-deployment-instance.EXT
full_hostname.EXT
full_hostname-instance.EXT
full_hostname-deployment.EXT
full_hostname-deployment-instance.EXT
local.EXT
local-instance.EXT
local-deployment.EXT
local-deployment-instance.EXT
(Finally, custom environment variables can override all files)
Where
• EXT can be .yml, .yaml, .xml, .coffee, .cson, .properties, .json, .json5, .hjson, .ts or .js depending on the format you prefer (see below)
• instance is an optional instance name string for Multi-Instance Deployments
• short_hostname is your server name up to the first dot, from the $HOST or $HOSTNAME environment variable or os.hostname() (in that order). For example if your hostname is www.example.com then it would load www.EXT.
• full_hostname is your whole server name, you may use this when short_hostname collides with other machines.
• deployment is the deployment name, from the $NODE_ENV (or if specified, $NODE_CONFIG_ENV) environment variable
The default.EXT file is designed to contain all configuration parameters from which other files may overwrite. Overwriting is done on a parameter by parameter basis, so subsequent files contain only the parameters unique for that override.
hostname and deployment files allow you to tune configurations for a particular server or deployment. These files are designed to live along with other files in your version control system.
As I am on the phone, I could not check if it is working, but I guess it must be an issue with the filename. Try to use default.json
instead development.json
.
From config’s documentation:
Files in the config directory are loaded in the following order:
default.EXT
default-instance.EXT
deployment.EXT
deployment-instance.EXT
short_hostname.EXT
short_hostname-instance.EXT
short_hostname-deployment.EXT
short_hostname-deployment-instance.EXT
full_hostname.EXT
full_hostname-instance.EXT
full_hostname-deployment.EXT
full_hostname-deployment-instance.EXT
local.EXT
local-instance.EXT
local-deployment.EXT
local-deployment-instance.EXT
(Finally, custom environment variables can override all files)
Where
• EXT can be .yml, .yaml, .xml, .coffee, .cson, .properties, .json, .json5, .hjson, .ts or .js depending on the format you prefer (see below)
• instance is an optional instance name string for Multi-Instance Deployments
• short_hostname is your server name up to the first dot, from the $HOST or $HOSTNAME environment variable or os.hostname() (in that order). For example if your hostname is www.example.com then it would load www.EXT.
• full_hostname is your whole server name, you may use this when short_hostname collides with other machines.
• deployment is the deployment name, from the $NODE_ENV (or if specified, $NODE_CONFIG_ENV) environment variable
The default.EXT file is designed to contain all configuration parameters from which other files may overwrite. Overwriting is done on a parameter by parameter basis, so subsequent files contain only the parameters unique for that override.
hostname and deployment files allow you to tune configurations for a particular server or deployment. These files are designed to live along with other files in your version control system.
As I am on the phone, I could not check if it is working, but I guess it must be an issue with the filename. Try to use default.json
instead development.json
.
answered Mar 6 at 21:21
f4z3k4sf4z3k4s
411
411
renamed todefault.json
and has the same error. Trieddeployment.json
and same error. The error is sticky.
– user938363
Mar 7 at 3:28
The error disappears after renamingcustom-environment-variables.json
todefault.json
underroot/config/
– user938363
Mar 7 at 5:02
add a comment |
renamed todefault.json
and has the same error. Trieddeployment.json
and same error. The error is sticky.
– user938363
Mar 7 at 3:28
The error disappears after renamingcustom-environment-variables.json
todefault.json
underroot/config/
– user938363
Mar 7 at 5:02
renamed to
default.json
and has the same error. Tried deployment.json
and same error. The error is sticky.– user938363
Mar 7 at 3:28
renamed to
default.json
and has the same error. Tried deployment.json
and same error. The error is sticky.– user938363
Mar 7 at 3:28
The error disappears after renaming
custom-environment-variables.json
to default.json
under root/config/
– user938363
Mar 7 at 5:02
The error disappears after renaming
custom-environment-variables.json
to default.json
under root/config/
– user938363
Mar 7 at 5:02
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%2f55031087%2fparse-error-when-config-reading-the-development-json%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
can you add relevant part of the
index.js
file.– Aritra Chakraborty
Mar 6 at 19:56
It is required in index.js
const config = require("config");
– user938363
Mar 6 at 19:58
unfortunately could not reproduce the issue using exact circumstance. I think your best bet is deleting node_modules and installing again.
– Aritra Chakraborty
Mar 6 at 20:07
try specific path of
development.json
inrequire('./development.json');
– Shadab Ahmed
Mar 6 at 20:09
Aritra Chakraborty
, did you mean deleting all modules under node-modules? Or just module config.– user938363
Mar 6 at 20:10