简体   繁体   English

如何使WebStorm向我显示凉亭包装清单?

[英]How can I get WebStorm to show me a list of bower packages?

Good morning. 早上好。

My setup: 我的设置:

  • OSX El Capitan 10.11.2 OSX El Capitan 10.11.2
  • JetBrains WebStorm 11.0.2 JetBrains WebStorm 11.0.2
  • Node.js 4.2.3 Node.js 4.2.3
  • NPM version 2.14.7 NPM版本2.14.7
  • Bower 1.7.0 凉亭1.7.0

Npm's prefix to ~/.npm-global Npm的前缀~/.npm-global

My executable path is set: $PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mike/.npm-global/bin 我的可执行路径设置为: $PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mike/.npm-global/bin

Running bower search [package] --json from the command line does return results. bower search [package] --json运行bower search [package] --json确实会返回结果。

The relevant lines (when Webstorm runs the search) from my log look like: 我的日志中的相关行(当Webstorm运行搜索时)如下所示:

2015-12-10 10:11:20,252 [1087432] INFO - ipt.bower.BowerCommandLineUtil - Running bower command: /usr/local/bin/node /Users/mike/.npm-global/bin/bower search --json 2015-12-10 10:11:20,739 [1087919] WARN - .BowerAvailablePackagesManager - [parse all bower packages] Top-level element should be object, but BEGIN_OBJECT found.

I did note that bower search --json (like Webstorm does, without specifying a package) returns bower usage information as a json object, which is funny, and I'm fairly confident this is the problem. 我确实注意到, bower search --json (就像Webstorm一样,没有指定包)将Bower的使用信息作为json对象返回,这很有趣,我很确定这是问题所在。 There are no relevant issues on the Webstorm forums. Webstorm论坛上没有相关问题。

This is really taking the 'I' out of 'IDE'. 这确实使“我”脱离了“ IDE”。

Can anybody offer a solution? 有人可以提供解决方案吗?

Here's what I'm seeing (or not seeing). 这就是我所看到的(或未看到的)。

UPDATE: I was correct in my original assumption but I lack the expertise and time to solve it properly. 更新:我最初的假设是正确的,但是我缺乏专​​业知识和时间来正确解决它。 My workaround is shown below. 我的解决方法如下所示。 Bower's search command is supposed to run without arguments but, when Webstorm calls bower search --json , the command is interpreted as incorrect and returns the search usage as a json object. Bower的search命令应该没有参数运行,但是,当Webstorm调用bower search --json ,该命令将被解释为不正确,并以json对象的形式返回搜索用法。 Silly stuff. 愚蠢的东西。 Hope this helps somebody else. 希望这对其他人有帮助。

problem is caused by recent changes in Bower ( https://github.com/eppeters/bower/commit/5a1e5eb9c717b4210d6a4af77eca1951bdd9f288 ); 问题是由Bower的最新更改引起的( https://github.com/eppeters/bower/commit/5a1e5eb9c717b4210d6a4af77eca1951bdd9f288 ); it now requires a module name neing passed to search command (though documentation hasn't yet been updated accordingly). 它现在需要将模块名称传递给search命令(尽管文档尚未进行相应的更新)。 Related JetBrains ticket: WEB-19389 ; JetBrains的相关门票: WEB-19389 fixed, fix will be available in next update 已修复,修复程序将在下次更新中提供

This is a gross fix and is unsuitable for use as long as there is any hair remaining on your head: 只要您的头上留有任何毛发,这就是一个严重的解决方法,因此不适合使用:

In [npm prefix]/bin/lib/node_modules/bower/lib/util/cli.js [npm prefix]/bin/lib/node_modules/bower/lib/util/cli.js

I added the following to intercept the command line options and force an empty search pattern: 我添加了以下内容以拦截命令行选项并强制使用空的搜索模式:

function readOptions() {

    ...

    noptOptions = nopt(types, shorthands, argv);

    ...

    // ADDED THE FOLLOWING

    if (noptOptions.argv.original.length == 2 && noptOptions.argv.original[0] == 'search' && noptOptions.argv.original[1] == '--json') {
    noptOptions.argv = {
        remain: ['search', ''],
        cooked: ['search', '', '--json'],
        original: ['search', '', '--json']
    };

    //////////////////////

    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM