Bower hangs after checkout step of Install command. - bower

I'm a github enterprise user and I'm using bower to point an internal repository to manage dependencies.
I have set up a repo and included a bower.json file in the root directory. It looks like this:
{
"name": "Axis",
"main": "Axis.js",
"version": "0.0.0",
"authors": [
"Nick Randall"
],
"description": "Chart Axis",
"keywords": [
"d3",
"d3.chart",
"axis"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"d3": "~3.4.6",
"d3.chart": "~0.2.0",
"lodash": "~2.4.1"
}
}
I'm trying to install the repo above as a dependency in a new project using "bower install Org/Axis" and the process hangs after the "Checkout" step. Am I doing something wrong or is this a bug?
My .bowerrc file looks like this:
{
"shorthand-resolver": "https://git.company.com/{{owner}}/{{package}}'.git"
}
and this is the response I get from the command line:
bower Axis#* not-cached https://git.company.com/Org/Axis.git#*
bower Axis#* resolve https://git.company.com/Org/Axis.git#*
bower Axis#* checkout v1.1.1
after that it just hangs there and never progresses.

About a year ago, there was an issue with bower hanging due to problems with the version of unzip. To see if your hanging may have the same cause you might try to install one of the dependencies individually. If an individual install doesn't hang you may have the same issue as before -- it occurred in the presence of certain combinations of node version and bower version. To try and load individually, consider for example:
bower install https://github.com/lodash/lodash.git

It turns out that this was a dumb mistake. I had my .bowerrc in the wrong location. Once I moved it to the root of my project, everything started working. I hope this helps somebody else!

Related

exclude files from build in electron via package.json

I am trying to build an electron app and during build creation exclude some files and folders.
I read similar topics and also bug thread on github but still cannot make it properly.
Final goal is to exclude all files with extension .py and folder named tests and all its subfolders.
However even simple example with one file with explicit name does not work. Can you please point me to my mistake?
Here is package.json
{
"name": "Build-Downloader",
"version": "0.1.0",
"main": "electron_main_win.js",
"scripts": {
"start": "electron ."
},
"dependencies": {
"axios": "^0.19.2",
"python-shell": "^1.0.8"
},
"build": {
"files": [
"!electron_backend.py"
]
}
}
and the command line I use to compile my package:
electron-packager ./ --platform=win32 --arch=x64 --electron-version=8.2.3 --out=electron_build --overwrite
Finally I found a solution on my own. I have already thrown a big stone to myself due to my stupidity :)
However I would like to share my knowledge in case somebody will need this info.
electron-packager supports only --ignore command line arguments with RegEx
Note: you may use as many ignores as you want
Note2: do not mix names electron-packager and electron-builder, builder supports package.json :)
So finally ultimate solution was:
electron-packager ./ --platform=win32 --arch=x64 --electron-version=8.2.3 --out=electron_build --overwrite --ignore="^.*\.py" --ignore="\/node_modules" --ignore="\/tests"

aurelia-dialog error with the release version and CLI

I'm facing a problem when using the new aurelai release :
I created a new app using : au new myApp
I installed aurelia-dialog via npm
When I import aurelia-dialog and try to run the app using
au run --watch
I get htis error :
[Error: ENOENT: no such file or directory, open 'C:\src\ai-dialog.js']
Any idea ?
The reason this is happening is because the package is a CommonJS package.
See: http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/10
Edit your aurelia_project/aurelia.json file from
"dependencies": [
"aurelia-dialog"
]
to
"dependencies": [
{
"name": "aurelia-dialog",
"path": "../node_modules/aurelia-dialog/dist/amd",
"main": "aurelia-dialog"
}
]
and that should solve your problem.
I got into the same issue. I have installed the aurelia dialog using below npm command
npm install aurelia-dialog --save
then just adding below dependencies to aurelia.json, resolved the issue
{
"name": "aurelia-dialog",
"path": "../node_modules/aurelia-dialog/dist/amd",
"main": "aurelia-dialog"
}
Things have changed a little bit since the release of aurelia-dialog 2.0.0.
The block you need to add in the aurelia.json dependencies definition is now the following one:
"dependencies": [
{
"name": "aurelia-dialog",
"path": "../node_modules/aurelia-dialog/dist/amd",
"main": "aurelia-dialog",
"resources": ["**/*.js"]
}
]

Installed bower dependencies not on latest commit

I have a git project which contains a bower.json file which contains several dependencies. It looks like this:
//module1
"dependencies": {
"devbridge-autocomplete": "devbridge/jQuery-Autocomplete#~1.2.21",
"backbone": "~1.2.1",
"underscore": "~1.8.3",
"jquery": "~2.1.4",
"module2": "gitUser/module2",
"module3": "gitUser/module3"
}
problem is when I run bower install --save gitUser/module1 bower does not pull the latest commits from github, and only pulls the initial commit.
bower.json of module2 and 3 are essentially similar:
{
"name": "module2",
"main": "module2.js",
"version": "0.0.0",
"authors": [
"gitUser <gitUser#gitUser.com>"
],
"moduleType": [
"amd"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"directory/bower_components",
"test",
"tests"
]
}
the cloned repositories hidden .bower.json looks like:
{
"name": "module2",
"_cacheHeaders": {
"Content-Type": "text/html; charset=utf-8"
},
"main": "index",
"_source": "https://github.com/gitUser/module2",
"_target": "*",
"_originalSource": "https://github.com/gitUser/module2"
}
I have also unsuccessfully tried installing dependencies in module1 by:
bower install --save gitUser/module2#latest
I have also tried adding git tags to each sub module, but this also did not work.
I saw this issue, so the tagging should not matter.
Any assistance appreciated!
If you want the latest commit from a specific branch:
bower install --save gitUser/module2#specific_branch_name
If you want a specific commit:
bower install --save gitUser/module2#specific_commit_id

bower install fails silently on any package

I can install Bower and it seems just fine via npm. I create a bower.json file using bower init, and add dependencies. Then when I use bower install, literally nothing happens in the terminal. I can use bower update to install packages, but bower install does not work and I cannot get any error to produce, even with --verbose. I've included bower.json below:
{
"name": "testing",
"version": "0.0.0",
"authors": [
"AJ"
],
"main": "index.html",
"license": "private",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.3.0",
"core-menu": "Polymer/core-menu",
"core-ajax": "Polymer/core-ajax"
}
}
edit: using 1.3.3, but I've reproduced this using 1.3.2 as well
Try removing the bower_components directory and running bower install again.
Edit:
This is also related to a circular dependency in Polymer see: https://github.com/bower/bower/issues/1324#issuecomment-44436595

Why does Bower remove my "resolutions" and how do I stop it

I have a bower.json file
{
"name": "example-project",
"private": true,
"dependencies": {
"angular": "1.2.14",
"angular-scenario": "1.2.14",
"angular-resource": "1.2.14",
"angular-ui-router": "0.2.10",
"angular-strap": "2.0.0"
}
}
When I run grunt (with grunt-bowercopy or grunt-bower-task) I get an error Fatal error: Unable to find suitable version for angular
When I run bower install it says it doesn't know which version of angular to use:
Unable to find a suitable version for angular, please choose one:
1) angular#1.2.14 which resolved to 1.2.14 and is required by angular-scenario#1.2.14, example-project
2) angular#>= 1.0.8 which resolved to 1.2.16 and is required by angular-ui-router#0.2.10
3) angular#~1.2.10 which resolved to 1.2.16 and is required by angular-strap#2.0.0
Prefix the choice with ! to persist it to bower.json
So that explains why grunt was failing - it had transitive dependencies and didn't know which one to select. So I choose 1 (!1 to persist). Now my bower.json looks like this:
{
"name": "example-project",
"private": true,
"dependencies": {
"angular": "1.2.14",
"angular-scenario": "1.2.14",
"angular-resource": "1.2.14",
"angular-ui-router": "0.2.10",
"angular-strap": "2.0.0"
},
"resolutions": {
"angular": "1.2.14"
}
}
Sweet! I run bower install again. This time it succeeds but removes the "resolutions" part. Now it just works for me without resolutions, but my coworkers will get the same error and have to go through the same process.
Why does it do this? Is there any way to stop it from happening?
-Update-
It seems that this is a bug. See bower issues https://github.com/bower/bower/issues/1061 and https://github.com/bower/bower/issues/1272. Hopefully the issue will get some attention and get resolved.
Upgrade to Bower 1.4.0 or greater where this issue is resolved.
Previous Answer:
A workaround suggested by edeustace (see https://github.com/bower/bower/issues/1061) is to add a script to your build (grunt, gulp, etc) that resets the resolutions as they should be after running bower. It's an ugly solution but should do the trick until the issue gets resolved.

Resources