2016-04-23 128 views
5

每次我使用Bower Tool時,我都會以json格式輸出。Bower輸出爲JSON格式

例如:

**涼亭幫助**

輸出cosole:

{ 
    "usage": [ 
    "<command> [<args>] [<options>]" 
    ], 
    "commands": { 
    "cache": "Manage bower cache", 
    "help": "Display help information about Bower", 
    "home": "Opens a package homepage into your favorite browser", 
    "info": "Info of a particular package", 
    "init": "Interactively create a bower.json file", 
    "install": "Install a package locally", 
    "link": "Symlink a package folder", 
    "list": "List local packages - and possible updates", 
    "login": "Authenticate with GitHub and store credentials", 
    "lookup": "Look up a package URL by name", 
    "prune": "Removes local extraneous packages", 
    "register": "Register a package", 
    "search": "Search for a package by name", 
    "update": "Update a local package", 
    "uninstall": "Remove a local package", 
    "unregister": "Remove a package from the registry", 
    "version": "Bump a package version" 
    }, 
    "options": [ 
    { 
     "shorthand": "-f", 
     "flag": "--force", 
     "description": "Makes various commands more forceful" 
    }, 
    { 
     "shorthand": "-j", 
     "flag": "--json", 
     "description": "Output consumable JSON" 
    }, 
    { 
     "shorthand": "-l", 
     "flag": "--loglevel", 
     "description": "What level of logs to report" 
    }, 
    { 
     "shorthand": "-o", 
     "flag": "--offline", 
     "description": "Do not hit the network" 
    }, 
    { 
     "shorthand": "-q", 
     "flag": "--quiet", 
     "description": "Only output important information" 
    }, 
    { 
     "shorthand": "-s", 
     "flag": "--silent", 
     "description": "Do not output anything, besides errors" 
    }, 
    { 
     "shorthand": "-V", 
     "flag": "--verbose", 
     "description": "Makes output more verbose" 
    }, 
    { 
     "flag": "--allow-root", 
     "description": "Allows running commands as root" 
    }, 
    { 
     "shorthand": "-v", 
     "flag": "--version", 
     "description": "Output Bower version" 
    }, 
    { 
     "flag": "--no-color", 
     "description": "Disable colors" 
    } 
    ] 
} 

,但結果應該看起來像這樣https://theenlighteneddeveloper.files.wordpress.com/2013/12/capture-d_c3a9cran-2013-12-08-c3a0-22-32-47.png

每個亭子命令出現該問題。

鮑爾版本:1.7.9 NPM版本:1.3.10 的Ubuntu 14.04

任何人知道如何爲人類更舒適的格式改變?

在此先感謝

+0

您是否在全球安裝涼亭? – randominstanceOfLivingThing

+0

是的,涼亭已在全球安裝。 – marianciu

+0

你似乎正在觸發-j選項,吐出可以被工具使用的json。 – randominstanceOfLivingThing

回答

15

在版本1.7.9中引入了一些變化。

我.bowerrc樣子:

{ 
    "directory": "bower_components", 
    "json": "bower.json" 
} 

我刪除「JSON」: 「bower.json」線和問題就解決了。