标签云

微信群

扫码加入我们

WeChat QR Code

“emalformed未能读取JSON的凉亭。”

i rather new to mean stack and i'm trying to pull some components using bower.

I have my .bowerrc file which gives the path for installation.

//.bowerrc
 {
    "directory": "public/libs"
 }

and i have my bower.json file which looks like this:

// bower.json
{
    "name": "starter-node-angular",
    "version": "1.0.0",
    "dependencies": {
        "bootstrap": "latest",
        "font-awesome": "latest",
        "animate.css": "latest",
        "angular": "latest",
        "angular-route": "latest"   
    }
}

When i installed bower i had no problem and even the bower search is working perfect. when I'm running the command:

bower install

i get the following message:

Failed to read + path\bower.json

Unexpected token /

i get the same message when I'm trying:

bower install jquery

I tried to change the encoding of file and used json online validation tool.

any ideas??


It is working so i guess the bower install recognize the comment sign // I think you are right about different cases. Thank you for yuor knowledge.

2018年05月27日29分31秒

"Convert to ANSI" is all I see in Notepad++, not "ASCII". But, "Convert to ANSI" did fix the issue

2018年05月27日29分31秒

This is strange. Reading here at stackoverflow.com/questions/22169387/… I converted to UTF-8. I quoted my keys and strings and then on reading this again saved the file with ANSI. Worked. Wondering if quotes were the only issue with JSON parsing ! Umm....which is a bit confusing as json files can work with or without quotes around the keys and values if they are of single word.

2018年05月27日29分31秒

The UTF-8 BOM was the real issue. You can use UTF-8 without BOM should work too.

2018年05月27日29分31秒

Thanks for mentioning the Visual Studio way. I didn't know this existed and was using Notepad++ for this kind of work until now.

2018年05月27日29分31秒