Cannot install package with Bower?

I am trying to install packages using Bower. I bring up the attached screen and I go through the screens to install jQuery and toastr. But, when I go back to the screen to see the packages installed I don't see them. Plus bower.json doesn't seem to be modified. I have attached the log file for these commands if it helps (it doesn't make much sense to me). Also here are the versions of the applicable programs that I am running:

>bower --version
1.3.12
>node --version
v0.10.35
>npm --version
1.4.28
>git --version
git version 1.9.5.msysgit.0

Thank you for any suggestions.

Kevin



Attachment(s):
idea.log.zip
36 comments
Comment actions Permalink

The log shows problems retrieving bower version and tasks list. Please open Windows console (cmd.exe), cd to the directory where your bower.json is located an run
C:\Users\Kevin\AppData\Roaming\npm\bower.cmd --version

what is the result?

Then try

C:\Users\Kevin\AppData\Roaming\npm\bower.cmd list --json

what is the output?

0
Comment actions Permalink

Thank you. I have included the requested output below:

>C:\Users\Kevin\AppData\Roaming\npm\bower.cmd --version
1.3.12

>C:\Users\Kevin\AppData\Roaming\npm\bower.cmd list --json
{
  "endpoint": {
    "name": "MultiVision",
    "source": "C:\\Users\\Kevin\\MultiVision",
    "target": "0.0.0"
  },
  "canonicalDir": "C:\\Users\\Kevin\\MultiVision",
  "pkgMeta": {
    "name": "MultiVision",
    "version": "0.0.0",
    "authors": [
      "Kevin Burton <rkevinburton@charter.net>"
    ],
    "description": "Extreme Tech Training",
    "moduleType": [
      "node"
    ],
    "license": "MIT",
    "private": true,
    "ignore": [
      "**/.*",
      "node_modules",
      "bower_components",
      "public/vendor",
      "test",
      "tests"
    ],
    "dependencies": {},
    "devDependencies": {}
  },
  "dependencies": {},
  "nrDependants": 0,
  "versions": []
}

0
Comment actions Permalink

Can you attach a project that shows up the issue? The minimum set of files needed to recreate it, may be just the .
idea folder and bower.json


0
Comment actions Permalink

I have attached the whole project.

Thank you.

Kevin



Attachment(s):
MultiVision.zip
0
Comment actions Permalink

Hmm.. works fine for me using your project. Please open WebStorm built-in terminal and run'C:\Users\Kevin\AppData\Roaming\npm\bower.cmd install jquery --save' - does it work?

0
Comment actions Permalink

Unfortunately not. The install step is missing.

Thank you.

Kevin
webstor_bowerinstall.jpg

0
Comment actions Permalink

Please try running the same command with -V option (verbose) - what
is the output?


0
Comment actions Permalink

Let me ask you a question: just to be clear, after installing "jquery" package (using WebStorm UI or built-in Terminal), is directory "public\vendor\jquery" created on your local drive?

A possible culprit might be configured "command processor autorun" (http://blogs.msdn.com/b/oldnewthing/archive/2007/11/21/6447771.aspx).
To verify that check the following registry keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
0
Comment actions Permalink

I see public/vendor but not jquery.

I don't have an autorun entry. Should I create one? If so what should its type be? I am sorry but I cannot glean what this key should be from the URL that you gave me. Surely it shouldn't be 'cd/'?

Thank you.

command_processor.jpg

0
Comment actions Permalink

No, you shouldn't create autorun entry. Its presence might lead to unexpected things, because every time *.cmd file is executed, commands from autorun registry entry are executed too.
Alright, "command processor autorun" isn't an issue in your case.

So far, I couldn't reproduce the issue on Linux. Will test this on Windows machine.

Meanwhile, please try the followings:
1. Clean bower cache

bower.cmd cache clean

2. Re-install bower

npm.cmd uninstall -g bower
npm.cmd install -g bower


BTW, what does "scripts" object from .bowerrc mean? I couldn't find description at http://bower.io/docs/config .

0
Comment actions Permalink

I tried to uninstall bower from the WebStorm command window and I get:

>npm.cmd bower uninstall -g bower

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, stars, start, stop, submodule, t, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, v,
    version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    C:\Users\Kevin\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

0
Comment actions Permalink

Correct command line to uninstall bower package:

npm.cmd uninstall -g bower

0
Comment actions Permalink

Thank you that worked much better.

Unfortunately this didn't reosolve the issue.

Kevinwebstor_bowerinstall.jpg

0
Comment actions Permalink

Unfortunately, I couldn't reproduce the issue on Windows 7.
AFAIU, this issue isn't caused by WebStorm Bower integration, because WebStorm integration runs the same command as users type in console (i.e. "bower install jquery --save"). And the result is the same for you.
I'd recommend you to file an issue in https://github.com/bower/bower.

According to your screenshot, "bower install jquery --save" command outputs

bower jquery#*              not-cached git://github.com/jquery/jquery.git#* bower jquery#*                 resolve git://github.com/jquery/jquery.git#* bower jquery#*                download https://github.com/jquery/jquery/archive/2.1.3.tar.gz bower jquery#*                 extract archive.tar.gz


and bower exits.

Here is my output:

bower jquery#*              not-cached git://github.com/jquery/jquery.git#* bower jquery#*                 resolve git://github.com/jquery/jquery.git#* bower jquery#*                download https://github.com/jquery/jquery/archive/2.1.3.tar.gz bower jquery#*                 extract archive.tar.gz bower jquery#*                resolved git://github.com/jquery/jquery.git#2.1.3
...


Reading bower source showed that a possible cause could be a thrown error that isn't logged and leads to bower process termination.
I've added some error logging: https://github.com/segrey/bower/commit/2e37c6ce5a4c294404e1e89b543b580d305b92ce
The change is compatible with bower@1.3.12.

You can try to apply it to your bower installation. Maybe it will help you to find out the cause.
Here is how it can be accomplished:
1. Locate your bower package. Accoding to the attached idea.log, it should be located at "C:\Users\Kevin\AppData\Roaming\npm\node_modules\bower"
2. Edit file "bower\lib\core\PackageRepository.js"
3. Replace "PackageRepository.prototype._resolve" method implementation with the one from https://raw.githubusercontent.com/segrey/bower/2e37c6ce5a4c294404e1e89b543b580d305b92ce/lib/core/PackageRepository.js and save the file.

After that just run "bower install jquery --save" in console. Hope it will shed some light on your problem.

0
Comment actions Permalink

Thank you for your efforts.
I made the changes to the bower installation but I didn't get any different output. It seems like when it works (on a different machine) an additional "install" notification appears. But your output doesn't have that step.

0
Comment actions Permalink

Well, it worked for me when I locked bower tmp directory intentionally to fail "extract" step.
To revert the change just do:
* npm uninstall bower -g
* npm install bower -g

Here is my full output of "bower install jquery --save" command:

bower not-cached    git://github.com/jquery/jquery.git#* bower resolve       git://github.com/jquery/jquery.git#* bower download      https://github.com/jquery/jquery/archive/2.1.3.tar.gz bower extract       jquery#* archive.tar.gz bower resolved      git://github.com/jquery/jquery.git#2.1.3 bower preinstall    node out.js pre jquery bower preinstall    a[0] = node bower preinstall    a[1] = /home/segrey/temp/MultiVision/out.js bower preinstall    a[2] = pre bower preinstall    a[3] = jquery bower install       jquery#2.1.3 bower postinstall   node out.js post jquery bower postinstall   a[0] = node bower postinstall   a[1] = /home/segrey/temp/MultiVision/out.js bower postinstall   a[2] = post bower postinstall   a[3] = jquery jquery#2.1.3 public/vendor/jquery


Did you run "bower cache clean" command?
What is output of "bower cache list" command?

Another possible culprit could be wrong fs permissions. Please check permissions of these folders: "C:\Users\Kevin\AppData\Roaming\bower\cache", your temporary directory (%TEMP%).

Also, you can try to install Node.js 0.11 (at this moment it's http://nodejs.org/dist/v0.11.16/).

0
Comment actions Permalink

Thanks again. I installed Node 11 but with no results. I have attached the permissions for the bower cache and my temp directory, but it appears that I have full control of those folders. The command 'bower cache list' command yields a single blank line, no output. bower cache clean didn't seem to help either.

bower_cache.jpgtemp.jpg

0
Comment actions Permalink

Thanks for the information.

About using Node.js 0.11: after installing you need to make sure that Node 0.11 is actually used to run bower.
Just in case: no need to alter %PATH%, node interpreter can be specified explicitly:

\path\to\node-0.11.exe C:\Users\Kevin\AppData\Roaming\npm\node_modules\bower\bin\bower install jquery --save



Also, you can try to downgrade your bower package. Maybe some previous bower version will work better on your machine.

List of bower release versions: https://github.com/bower/bower/releases
To downgrade to say 1.3.11, run "npm install bower@1.3.11 -g"


If nothing helped, then, well, seems you need to debug bower yourself. Debugging bower on my machine gave nothing - the issue isn't reproducible for me..
Hope something will help.
0
Comment actions Permalink

Well nothing worked. Do you have any hints as to how to setup bower for debug and/or where would be a good place to start?

0
Comment actions Permalink

Sad to hear nothing worked.
To configure an enviornment for debugging "bower install jquery" command please do the following:
1. Download install-bower-package.zip, unzip it to a directory (install-bower-package/) and open the directory in WebStorm
2. Right-click package.json and select "Run 'npm install'" to install node dependencies listed in package.json
3. Ensure that running "/path/to/node.exe ./node_modules/bin/bower install jquery --save" still doesn't work in console.
3. On the main menu click "Run | Edit Configurations...". You'll find there two preconfigured "Node.js" run configurations ("bower-install-jquery" and "bower-state-cleaner"). Correct path to Node interpreter in "Node interpreter" field for both run configurations.
Example:
bower-install-jquery-run-configuration.png
4. Setup breakpoints. According to your output

bower jquery#*              not-cached git://github.com/jquery/jquery.git#* bower jquery#*                 resolve git://github.com/jquery/jquery.git#* bower jquery#*                download https://github.com/jquery/jquery/archive/2.1.3.tar.gz bower jquery#*                 extract archive.tar.gz


you have "extract" step logged, but not "resolved" (the next log entry).
Put these breakpoints:
* node_modules/bower/lib/core/PackageRepository.js, two breakpoints at lines 182-nd and 188-th
* node_modules/bower/lib/core/resolvers/GitHubResolver.js, one breakpoint at line 96-th

5. On the main menu click "Run | Debug..." and select "bower-install-jquery" in popup. First, "bower-state-cleaner.js" file will be executed to prepare a clean state for debugging. If preparation is OK, debugging session will be started.
All "bower-install-jquery" run configuration does is executing "bower install jquery --save" command.
Hopefully, a breakpoint from "extract" action logging will be hit, like this:
bower-extract-breakpoint-hit.png
Then, you need to figure out why "resolved" action isn't logged. Good luck!
Feel free to ask if you meet some difficulties performing these steps.



Attachment(s):
install-bower-package.zip
0
Comment actions Permalink

Thank you very much. I think we are making some head way.

I went through steps 1-3 and found that the command line that you suggested in 3 works. So how does that differ from "bower install jquery --save" (other than the obvious that one is running from node_modules and the other is from a -g install)?

I would like to be able to use "bower install jquery --save".

Thanks again.

0
Comment actions Permalink

Great. Good to know it worked.

If I understand correctly, this command fails

/path/to/node.exe C:/Users/Kevin/AppData/Roaming/npm/node_modules/bower/bin/bower install jquery --save


And this command runs successfully

/path/to/node.exe /path/to/install-bower-package/node_modules/bower/bin/bower install jquery --save


Both command are run in the same directory ("/path/to/install-bower-package"). And the same node interpreter is used for both commands.
Am I correct?

If yes, then seems you need to compare two bower installations. Are they identical?

0
Comment actions Permalink

Acutally it is a little different.

This fails:

bower install jquery --save (irun from a different folder)

And this works

"\Program Files\nodejs\node.exe" ./node_modules/bower/bin/bower install jquery --save (run from the terminal window in WebStorm)

0
Comment actions Permalink

I found another node.exe and this command also works

C:\Users\Kevin\AppData\Roaming\npm\node.exe ./node_modules/bower/bin/bower install jquery --save

But

bower install jquery --save

still does not work. Any ideas what is wrong with my configuration?

0
Comment actions Permalink

Do you run all these commands from the same directory (your project directory)?

0
Comment actions Permalink

I run these commands from the WebStorm terminal console.

0
Comment actions Permalink

When running "bower install jquery --save" in console, node interpreter "C:\Users\Kevin\AppData\Roaming\npm\node.exe" should be used.
This is so, because "bower" command is resolved to "C:\Users\Kevin\AppData\Roaming\npm\bower.cmd" and its content usually looks like this

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" "%~dp0\node_modules\bower\bin\bower" %*
) ELSE (
  node "%~dp0\node_modules\bower\bin\bower" %*
)


Please run the following commands in WebStorm terminal console:
1. What the output of this command:

C:\Users\Kevin\AppData\Roaming\npm\node.exe --version

2. Change directory to "install-bower-package/" where install-bower-package.zip is extracted to.
3. Run

bower install jquery --save

Is it still failing as expected?
4. Run

C:\Users\Kevin\AppData\Roaming\npm\node.exe C:/Users/Kevin/AppData/Roaming/npm/node_modules/bower/bin/bower install jquery --save

Is it failing? What's the output?
5. Run

C:\Users\Kevin\AppData\Roaming\npm\node.exe ./node_modules/bower/bin/bower install jquery --save

Is it working? What's the output?
Thanks.

0
Comment actions Permalink

Thank you for your help

1) C:\Users\Kevin\AppData\Roaming\npm\node.exe --version
v0.8.18
Which is interesting because in the same directory running node --version
v0.11.16


2-3) bower install jquery --save => works

bower jquery#*                  cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#*                validate 2.1.3 against git://github.com/jquery/jquery.git#*
bower jquery#~2.1.3            install jquery#2.1.3

jquery#2.1.3 bower_components\jquery



4) C:\Users\Kevin\AppData\Roaming\npm\node.exe C:/Users/Kevin/AppData/Roaming/npm/node_modules/bower/bin/bower install jquery --save
=> works

C:\Users\Kevin\install-bower-package>C:\Users\Kevin\AppData\Roaming\npm\node.exe C:/Users/Kevin/AppData/Roaming/npm/node_modules/bower/bin/bower install jquery --save
bower jquery#*                  cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#*                validate 2.1.3 against git://github.com/jquery/jquery.git#*
bower jquery#~2.1.3            install jquery#2.1.3

jquery#2.1.3 bower_components\jquery



5) C:\Users\Kevin\AppData\Roaming\npm\node.exe ./node_modules/bower/bin/bower install jquery --save => works

bower jquery#*                  cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#*                validate 2.1.3 against git://github.com/jquery/jquery.git#*
bower jquery#~2.1.3            install jquery#2.1.3

jquery#2.1.3 bower_components\jquery



Basically all of the commands seemed to work. It has the feeling of a cache issue because I know it failed. And as soon as I declare it working I am afraid that it will revert back.
Also what do you thing is up with the different node versions? Or do you think that is part of the problem?

I also found a node.exe in "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\bin\node.exe" This node reports
"C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\bin\node.exe" --version
v0.10.23

So having just one node version would be nice?
0

Please sign in to leave a comment.