Bower Malformed

2019-03-06 03:29发布

问题:

I'm learning how to use Bower. In an effort to get started, I've created a basic bower.json file whose responsibilty is to get jquery. My bower.json file looks like this:

{
    "name":  "MyProject",
    "version": "0.0.1",
    "devDependencies": {
        "jquery": "~2.1.0"
    }
}

When I run bower install from the directory where my bower.json file is located, I get the following error:

bower                       EMALFORMED Failed to read C:\Projects\MyProject\bower.json

What am I doing wrong? I keep looking for something to be syntactically incorrect. However, everything looks correct to me. Thank you so much for your help!

回答1:

Since you are on windows, it's quite likely you are having issue with a BOM and/or another utf8/utf16 encoding issue.

Take a look here

Try again with a text editor that doesn't do stupid things (maybe Sublime Text - I'm not too sure what's good on windows).



回答2:

Seems like unsolved bug

see link: https://github.com/bower/bower/issues/783

Try using this

{
    "name":  "MyProject",
    "version": "0.0.1",
    "dependencies": {
        "jquery": "~2.1.0"
    }
}

if this didn't work try updating your bower using npm update -g bower



标签: json bower