厌倦了凉亭下载我安装的每个仓库中的所有内容,我设置了bower-installer。
https://scotch.io/tutorials/only-grab-the-files-you-need-while-using-bower
然而,在运行bower-installer
后,我收到了这个奇怪的错误:
bower-installer
/usr/local/lib/node_modules/bower-installer/bower-installer.js:56
throw createError('Neither bower.json nor component.json present', 'ENOEN
我的bower.json文件就在那里,下面是什么:
{
"name": "app",
"main": "app.js",
"version": "0.0.0",
"authors": [
"Leon"
],
"description": "My app",
"keywords": [
"tags",
"manage"
],
"license": "MIT",
"homepage": "me.com",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular-bootstrap": "~0.12.1",
"angular-loader": "1.2.x",
"angular-mocks": "~1.2.x",
"angular-route": "1.2.x",
"angular-scroll": "~0.6.5",
"chartist": "~0.7.3",
"bootstrap": "~3.3.4",
"angular": "~1.3.15"
},
"install": {
"path": "libs",
"sources": {
"angular": "bower_components/angular/angular.min.js",
"bootstrap": "bower_components/bootstrap/dist/js/bootstrap.min.js",
"chartist": [
"bower_components/chartist/dist/chartist.min.js",
"bower_components/chartist/dist/chartist.min.css",
],
"angular-scroll": "bower_components/angular-scroll/angular-scroll.min.js",
"angular-route": "bower_components/angular-route/angular-route.min.js",
"angular-mocks": "bower_components/angular-mocks/angular-mocks.js",
"angular-loader": "bower_components/angular-loader/angular-loader.min.js",
"angular-bootstrap": [
"bower_components/angular-bootstrap/ui-bootstrap-tpls.js",
"bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js",
"bower_components/angular-bootstrap/ui-bootstrap.js",
"bower_components/angular-bootstrap/ui-bootstrap.min.js"
]
}
}
}
答案 0 :(得分:2)
您的bower.json不正确,此部分
"chartist": [
"bower_components/chartist/dist/chartist.min.js",
"bower_components/chartist/dist/chartist.min.css",
],
应该是
"chartist": [
"bower_components/chartist/dist/chartist.min.js",
"bower_components/chartist/dist/chartist.min.css"
],
所以删掉最后一个逗号。该逗号使json无效,因此bower安装程序无法解析它。我用你的bower.json验证了这一点,删除逗号后它工作正常。