简体   繁体   中英

node-config cannot parse config SyntaxError: Unexpected token

I'm trying to use node-config in my Node.js project.

Unfortunately I keep receiving an error when node-config tries to parse my JSON.

Here's the JSON throwing the error (actual data replaced with placeholder data)

{
    "Winston": {
        "Mail": {
            "to": "abc@test.com",
            "from": "errors@test.com",
            "host": "localhost"
        }
    }
}

Here's the error that I'm receiving:

Error: Cannot parse config file: '../config/default.json' SyntaxError:Unexpected token 

I can't see where the syntax is incorrect but any help is appreciated.

Marc B , that did the trick.

I actually recreated the file in a different editor and that cleared up all of the issues.

The original .json file that I posted was created using the .json template in VS2013 with Node Tools for Visual Studio installed. Once I recreated the file using Atom.io and relaunched my node app everything worked perfectly.

Thanks again for the help Marc B .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM