Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bower install [package name] should NOT re-install all packages from bower.json #2379

Closed
dotnetCarpenter opened this issue Oct 14, 2016 · 2 comments

Comments

@dotnetCarpenter
Copy link

dotnetCarpenter commented Oct 14, 2016

I use GNU Make to update/install third party front end libraries.

My work flow is the following:

  1. bower install [package] --save
  2. Copy bower list --paths to Makefile as a variable. E.i. LIBRARIES
  3. Create a new variable. E.g. LIBRARIES_TARGET := $(patsubst %,app/lib/%, $(notdir $(LIBRARIES)))
  4. In my Makefile, I make LIBRARIES_TARGET a target which depend on LIBRARIES. If a library is not present in app/lib/[bower main file(s)], Make will run the following recipe: bower install $(notdir $@) --production. This can evaluate to bower install svg.js --production and bower install svg.draggable.js --production.

This seems to trigger a lot of superfluous work by bower.

bower install should not re-install all packages from bower.json

I hope this is just dependency management but it look like bower is taking an abundant download route. GNU Make will run tasks in parallel. So 2 instances of bower is likely to run at the same time.

My entire Makefile (note, that I have replaced common GNU tools with the nodejs equivalent to support all nodejs platforms):

LIBRARIES := bower_components/svg.js/dist/svg.js bower_components/svg.draggable.js/dist/svg.draggable.js
LIBRARIES_TARGET_FOLDER = app/lib/
LIBRARIES_TARGET := $(patsubst %,$(LIBRARIES_TARGET_FOLDER)%, $(notdir $(LIBRARIES)))

all: $(LIBRARIES_TARGET)

$(LIBRARIES):
    npm run bower -- install $(notdir $@) --production

$(LIBRARIES_TARGET_FOLDER):
    npm run mkdirp -- $(dir $@)

$(LIBRARIES_TARGET): $(LIBRARIES) |$(LIBRARIES_TARGET_FOLDER)
    npm run cp -- $(filter %$(@F),$^) $@

In a clean git clone of my project this triggers:

npm run mkdirp -- app/lib/
npm run bower -- install svg.js --production
npm run bower -- install svg.draggable.js --production
npm run cp -- bower_components/svg.js/dist/svg.js app/lib/svg.js
npm run cp -- bower_components/svg.draggable.js/dist/svg.draggable.js app/lib/svg.draggable.js

This is related to #256

Below is the entire output from bower:

npm run bower -- install svg.js --production
npm run bower -- install svg.draggable.js --production

> virtualcontrol@ bower /home/dotnet/projects/playground/virtualcontrol
> bower "install" "svg.js" "--production"


> virtualcontrol@ bower /home/dotnet/projects/playground/virtualcontrol
> bower "install" "svg.draggable.js" "--production"

bower svg.draggable.js#~2.2.1   cached https://github.com/wout/svg.draggable.js.git#2.2.1
bower svg.draggable.js#~2.2.1 validate 2.2.1 against https://github.com/wout/svg.draggable.js.git#~2.2.1
bower svg.js#~2.3.5             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#~2.3.5           validate 2.3.5 against https://github.com/wout/svg.js.git#~2.3.5
bower svg.js#*                  cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#*                validate 2.3.5 against https://github.com/wout/svg.js.git#*
bower svg.draggable.js#*        cached https://github.com/wout/svg.draggable.js.git#2.2.1
bower svg.draggable.js#*      validate 2.2.1 against https://github.com/wout/svg.draggable.js.git#*
bower svg.js#~2.3.5             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#~2.3.5           validate 2.3.5 against https://github.com/wout/svg.js.git#~2.3.5
bower svg.draggable.js#~2.2.1   cached https://github.com/wout/svg.draggable.js.git#2.2.1
bower svg.draggable.js#~2.2.1 validate 2.2.1 against https://github.com/wout/svg.draggable.js.git#~2.2.1
bower svg.js#^2.0.1             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#^2.0.1           validate 2.3.5 against https://github.com/wout/svg.js.git#^2.0.1
bower svg.draggable.js#~2.2.1  install svg.draggable.js#2.2.1
bower svg.js#^2.0.1            install svg.js#2.3.5
bower svg.js#^2.0.1             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#^2.0.1           validate 2.3.5 against https://github.com/wout/svg.js.git#^2.0.1

svg.draggable.js#2.2.1 bower_components/svg.draggable.js
└── svg.js#2.3.5

svg.js#2.3.5 bower_components/svg.js
bower svg.draggable.js#~2.2.1  install svg.draggable.js#2.2.1
bower                          skipped svg.draggable.js was not installed because there is already a non-bower directory with that name in the components directory (bower_components/svg.draggable.js). You can force installation with --force.
bower svg.js#^2.0.1            install svg.js#2.3.5
bower                          skipped svg.js was not installed because there is already a non-bower directory with that name in the components directory (bower_components/svg.js). You can force installation with --force.

svg.draggable.js#2.2.1 ../../../.cache/bower/packages/9857026e0b74f4ea1f206c5dc8911402/2.2.1
└── svg.js#2.3.5

svg.js#2.3.5 ../../../.cache/bower/packages/09c33df7193f0be8b28fda1d2550b945/2.3.5
npm run mkdirp -- app/lib/

> virtualcontrol@ mkdirp /home/dotnet/projects/playground/virtualcontrol
> mkdirp "app/lib/"

npm run cp -- bower_components/svg.js/dist/svg.js app/lib/svg.js
npm run cp -- bower_components/svg.draggable.js/dist/svg.draggable.js app/lib/svg.draggable.js

> virtualcontrol@ cp /home/dotnet/projects/playground/virtualcontrol
> cp "bower_components/svg.js/dist/svg.js" "app/lib/svg.js"


> virtualcontrol@ cp /home/dotnet/projects/playground/virtualcontrol
> cp "bower_components/svg.draggable.js/dist/svg.draggable.js" "app/lib/svg.draggable.js"

bower install is racy. Sometimes the install fails:

npm run bower -- install svg.js --production
npm run bower -- install svg.draggable.js --production

> virtualcontrol@ bower /home/dotnet/projects/playground/virtualcontrol
> bower "install" "svg.js" "--production"


> virtualcontrol@ bower /home/dotnet/projects/playground/virtualcontrol
> bower "install" "svg.draggable.js" "--production"

bower svg.draggable.js#~2.2.1   cached https://github.com/wout/svg.draggable.js.git#2.2.1
bower svg.draggable.js#~2.2.1   cached https://github.com/wout/svg.draggable.js.git#2.2.1
bower svg.draggable.js#~2.2.1 validate 2.2.1 against https://github.com/wout/svg.draggable.js.git#~2.2.1
bower svg.draggable.js#~2.2.1 validate 2.2.1 against https://github.com/wout/svg.draggable.js.git#~2.2.1
bower svg.js#~2.3.5             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#~2.3.5           validate 2.3.5 against https://github.com/wout/svg.js.git#~2.3.5
bower svg.js#~2.3.5             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#~2.3.5           validate 2.3.5 against https://github.com/wout/svg.js.git#~2.3.5
bower svg.js#*                  cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#*                validate 2.3.5 against https://github.com/wout/svg.js.git#*
bower svg.draggable.js#*        cached https://github.com/wout/svg.draggable.js.git#2.2.1
bower svg.draggable.js#*      validate 2.2.1 against https://github.com/wout/svg.draggable.js.git#*
bower svg.js#^2.0.1             cached https://github.com/wout/svg.js.git#2.3.5
bower svg.js#^2.0.1           validate 2.3.5 against https://github.com/wout/svg.js.git#^2.0.1
bower svg.js#~2.3.5            install svg.js#2.3.5
bower svg.draggable.js#~2.2.1  install svg.draggable.js#2.2.1
bower svg.draggable.js#~2.2.1  install svg.draggable.js#2.2.1
bower svg.js#^2.0.1            install svg.js#2.3.5
bower                           ENOENT ENOENT: no such file or directory, lstat '/home/dotnet/projects/playground/virtualcontrol/bower_components/svg.js/.bower.json'

Stack trace:
/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/node_modules/fstream/lib/writer.js:285:28
FSReqWrap.oncomplete (fs.js:123:15)

Console trace:
Error
    at StandardRenderer.error (/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/renderers/StandardRenderer.js:81:37)
    at Logger.<anonymous> (/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/bin/bower.js:110:26)
    at emitOne (events.js:96:13)
    at Logger.emit (events.js:188:7)
    at Logger.emit (/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
    at /home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/commands/index.js:48:20
    at _rejected (/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/node_modules/q/q.js:844:24)
    at /home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/node_modules/q/q.js:870:30
    at Promise.when (/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/node_modules/q/q.js:1122:31)
    at Promise.promise.promiseDispatch (/home/dotnet/projects/playground/virtualcontrol/node_modules/bower/lib/node_modules/q/q.js:788:41)
System info:
Bower version: 1.7.9
Node version: 6.7.0
OS: Linux 4.4.0-42-generic x64

npm ERR! Linux 4.4.0-42-generic
npm ERR! argv "/home/dotnet/.nvm/versions/node/v6.7.0/bin/node" "/home/dotnet/.nvm/versions/node/v6.7.0/bin/npm" "run" "bower" "--" "install" "svg.draggable.js" "--production"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! virtualcontrol@ bower: `bower "install" "svg.draggable.js" "--production"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the virtualcontrol@ bower script 'bower "install" "svg.draggable.js" "--production"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the virtualcontrol package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower "install" "svg.draggable.js" "--production"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs virtualcontrol
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls virtualcontrol
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/dotnet/projects/playground/virtualcontrol/npm-debug.log
Makefile:22: recipe for target 'bower_components/svg.draggable.js/dist/svg.draggable.js' failed
make: *** [bower_components/svg.draggable.js/dist/svg.draggable.js] Error 1
make: *** Waiting for unfinished jobs....

svg.draggable.js#2.2.1 bower_components/svg.draggable.js
└── svg.js#2.3.5

svg.js#2.3.5 bower_components/svg.js

My bower.json file:

{
  "name": "virtualcontrol",
  "dependencies": {
    "svg.draggable.js": "~2.2.1",
    "svg.js": "~2.3.5"
  }
}
@sheerun
Copy link
Contributor

sheerun commented Nov 8, 2016

This is not something we have resources to fix. Attempt was made to fix #256 but reverted becuase of #2097. I'm closing it as duplicate of #256

If you feel you can fix remaining link issue, please do it.

@sheerun sheerun closed this as completed Nov 8, 2016
@dotnetCarpenter
Copy link
Author

I would take a look but it's discouraging that you have 30 open PR's where most of them are a year old or older. I get a feeling that my hard work will never be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants