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
请先登录再写评论。
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?
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": []
}
Any ideas?
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
I have attached the whole project.
Thank you.
Kevin
Attachment(s):
MultiVision.zip
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?
Unfortunately not. The install step is missing.
Thank you.
Kevin
Please try running the same command with -V option (verbose) - what
is the output?
Same output.
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:
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.
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
2. Re-install bower
BTW, what does "scripts" object from .bowerrc mean? I couldn't find description at http://bower.io/docs/config .
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
Correct command line to uninstall bower package:
Thank you that worked much better.
Unfortunately this didn't reosolve the issue.
Kevin
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
and bower exits.
Here is my output:
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.
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.
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:
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/).
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.
Thanks for the information.
Just in case: no need to alter %PATH%, node interpreter can be specified explicitly:
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.
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?
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:
4. Setup breakpoints. According to your output
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:
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
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.
Great. Good to know it worked.
If I understand correctly, this command fails
And this command runs successfully
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?
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)
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?
Do you run all these commands from the same directory (your project directory)?
I run these commands from the WebStorm terminal console.
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
Please run the following commands in WebStorm terminal console:
1. What the output of this command:
2. Change directory to "install-bower-package/" where install-bower-package.zip is extracted to.
3. Run
Is it still failing as expected?
4. Run
Is it failing? What's the output?
5. Run
Is it working? What's the output?
Thanks.
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#* 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
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?