bower.json:main存在,但我得到一个"(...)缺少"bower.json中的"主要条目"警告

Ala*_*blo 9 jquery json bower

我正在尝试将此jquery插件注册到Bower.

bower.json文件如下所示:

{
    "name": "domajax",
    "version": "2.1.0",
    "homepage": "http://domajax.com",
    "description": "Domajax is a free jQuery plugin that give you tools to add ajax calls within your application, without a piece of javascript.",
    "main": [
        "js/jquery.domajax.js"
    ],
    "keywords": [
        "domajax",
        "ajax",
        "jquery",
        "plugin",
        "javascript",
        "dom",
        "html"
    ],
    "authors": [
        "Alain Tiemblo"
    ],
    "repository": {
        "type": "git",
        "url": "git://github.com/ninsuo/domajax.git"
    },
    "bugs": "https://github.com/ninsuo/domajax/issues",
    "license": "MIT",
    "ignore": ["./!(js/jquery.domajax.js)"],
    "dependencies": {
        "jquery": ">=1.7",
        "jquery.ui": "*",
        "json2-js": "*"
    }
}
Run Code Online (Sandbox Code Playgroud)

您可以看到mainignore条目都已设置,但是当我将插件注册到Bower时,我收到以下警告:

bower domajax#*           invalid-meta domajax is missing "main" entry in bower.json
bower domajax#*           invalid-meta domajax is missing "ignore" entry in bower.json
Run Code Online (Sandbox Code Playgroud)

为什么这些条目在我的bower.json文件中被标记为缺失?

仅供参考,这是完整输出:

ninsuo:domajax alain$ bower register domajax https://github.com/ninsuo/domajax
bower                          convert Converted https://github.com/ninsuo/domajax to git://github.com/ninsuo/domajax.git
bower domajax#*                resolve git://github.com/ninsuo/domajax.git#*
bower domajax#*               download https://github.com/ninsuo/domajax/archive/2.1.0.tar.gz
bower domajax#*                extract archive.tar.gz
bower domajax#*           invalid-meta domajax is missing "main" entry in bower.json
bower domajax#*           invalid-meta domajax is missing "ignore" entry in bower.json
bower domajax#*               resolved git://github.com/ninsuo/domajax.git#2.1.0
? Registering a package will make it installable via the registry (https://bower.herokuapp.com), continue?: No
Run Code Online (Sandbox Code Playgroud)

Dro*_*sky 7

Bower包版本基于git标签(标签名称应符合semver标准).
在注册您的软件包时,Bower将在最新的标签中查找bower.json - 在您的情况下为2.1.0.这可以在您在问题中提供的输出中看到:

bower domajax#*               download https://github.com/ninsuo/domajax/archive/2.1.0.tar.gz
Run Code Online (Sandbox Code Playgroud)

在您的情况下,2.1.0标记根本不包含bower.json(该文件仅存在于主分支中).要解决此问题,您需要确保bower.json文件存在于项目标记中(或至少是最新的).