bower.json: main 存在但我收到“(...) bower.json 中缺少 "main" 条目”警告
bower.json: main is present but I get a "(...) is missing "main" entry in bower.json" warning
我正在尝试注册 this jquery plugin 到 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": "*"
}
}
你可以看到 main 和 ignore 条目都已设置,但是当我将插件注册到 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?
仅供参考,这是完整的输出:
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
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(该文件仅存在于 master 分支中)。要解决此问题,您需要确保 bower.json 文件存在于您的项目标签中(或至少是最新的标签)。
我正在尝试注册 this jquery plugin 到 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": "*"
}
}
你可以看到 main 和 ignore 条目都已设置,但是当我将插件注册到 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?
仅供参考,这是完整的输出:
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
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(该文件仅存在于 master 分支中)。要解决此问题,您需要确保 bower.json 文件存在于您的项目标签中(或至少是最新的标签)。