Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bower.json: main is present but I get a "(...) is missing "main" entry in bower.json" warning

Tags:

json

jquery

bower

I'm trying to register this jquery plugin to Bower.

The bower.json file looks like this:

{
    "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": "*"
    }
}

You can see that both main and ignore entries are set, but I get the following warnings when I register the plugin to 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

Why those entries are marked as missing on my bower.json file?

FYI, here is the full output:

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
like image 316
Alain Tiemblo Avatar asked Mar 14 '15 08:03

Alain Tiemblo


1 Answers

Bower package versions are based on git tags (tag names should be semver compliant).
When registering your package, Bower will look for the bower.json in the latest tag - in your case 2.1.0. This can be seen in the output you provided in your question:

bower domajax#*               download https://github.com/ninsuo/domajax/archive/2.1.0.tar.gz

In your case, the 2.1.0 tag does not contain a bower.json at all (the file is only present in the master branch). To fix the issue you need to make sure that the bower.json file is present in your project tags (or at least the latest one).

like image 73
Dror Bereznitsky Avatar answered Nov 15 '22 20:11

Dror Bereznitsky