厌倦了在我安装的每个回购程序中下载所有的内容,我设置了bower-安装程序。
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"
]
}
}
}发布于 2015-03-31 20:18:04
您的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验证了这一点,在去掉逗号之后,它运行得很好。
https://stackoverflow.com/questions/29377440
复制相似问题