Search code examples
node.jsnpmbowerwebstorm

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


Good morning.

My setup:

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

Npm's prefix to~/.npm-global

My executable path is set: $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.

The relevant lines (when Webstorm runs the search) from my log look like:

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. There are no relevant issues on the Webstorm forums.

This is really taking the 'I' out of '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. Silly stuff. Hope this helps somebody else.


Solution

  • problem is caused by recent changes in 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). Related JetBrains ticket: WEB-19389; fixed, fix will be available in next update