2016-04-23 24 views
5

Mỗi lần tôi làm gì với Công cụ Bower, tôi nhận được kết quả ở định dạng json.Đầu ra Bower có định dạng JSON

Ví dụ:

** Chòi giúp đỡ **

đầu ra trong 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" 
    } 
    ] 
} 

nhưng kết quả nên trông như thế này https://theenlighteneddeveloper.files.wordpress.com/2013/12/capture-d_c3a9cran-2013-12-08-c3a0-22-32-47.png

vấn đề đó xảy ra với mỗi lệnh Chòi chơi .

Bower phiên bản: phiên bản 1.7.9 NPM: 1.3.10 Ubuntu 14,04

Bất kỳ ai biết làm thế nào để thay đổi định dạng cho dễ chịu hơn cho con người?

Cảm ơn trước

+0

Bạn đã cài đặt bower trên toàn cầu chưa? – randominstanceOfLivingThing

+0

Có, bower đã được cài đặt trên toàn cầu. – marianciu

+0

Có vẻ như bạn đang kích hoạt tùy chọn -j để tách ra json có thể được sử dụng bởi các công cụ. – randominstanceOfLivingThing

Trả lời

15

Trong phiên bản 1.7.9 giới thiệu một số thay đổi.

.bowerrc tôi trông như thế:

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

Tôi đã gỡ bỏ "json": "bower.json" dòng và vấn đề giải quyết.

Các vấn đề liên quan