bower.json:main属性已存在,但我收到“bower.json中缺少“main”条目”的警告。

9

我正在尝试将这个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": "*"
    }
}

您可以看到,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

为什么我的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
1个回答

7
Bower包的版本基于git标签(标签名称应符合semver规范)。 在注册您的包时,Bower将查找最新标签中的bower.json - 在您的情况下为2.1.0。这可以在您在问题中提供的输出中看到:
bower domajax#*               download https://github.com/ninsuo/domajax/archive/2.1.0.tar.gz

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


嗨。我读了快速入门并看到“您的软件包必须在 Git 端点(例如 GitHub)上公开可用。请记得推送您的 Git 标签!”,但是我没有理解他们的警告。谢谢 :) - Alain Tiemblo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接