Bower Malformed

≡放荡痞女 提交于 2019-12-31 07:17:31

问题


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



来源:https://stackoverflow.com/questions/22578596/bower-malformed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!