I am using bower see dependencies from my bower.json below, so the question is I want bower to give a report of dependencies with newer version release but without installing it, for insatnce using npm-check-updates for npm give a nice list of dependencies that are outdated.
...
"dependencies": {
"angular": "1.3.0-beta.17",
"angular-animate": "1.3.0-beta.17",
"angular-mocks": "1.3.0-beta.17",
"angular-resource": "1.3.0-beta.17",
"angular-route": "1.3.0-beta.17",
"angular-ui-select2": "~0.0.5",
"underscore": "~1.x",
"bootstrap": "~3.x",
"components-font-awesome": "~4.x",
"angular-bootstrap": "~0.11.0",
"ng-grid": "~2.0.11",
"AngularJS-Toaster": "~0.4.6",
"intro.js": "~0.9.0",
"angular-intro.js": "~1.1.1"
},
...
You can just do bower ls and it'll tell you which packages are outdated. However there's discussion regarding adding an outdated command alias to be consistent with other package managers, included npm. You can voice your support here: https://github.com/bower/bower/issues/1138
Related
Since the current VS code doesn't support Electron v1.6, so I have to downgrade my Electron version. However, I found that I can not install the old version of Electron by giving the version number in the package.json file. The following is my configuration:
{
"name": "Example",
"version": "1.0.0",
"description": "",
"main": "./app/main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "electron ."
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron-builder": "^15.5.1",
"electron": "^1.4",
"electron-rebuild": "^1.5.7"
},
"dependencies": {
"jquery": "^3.1.1",
"sqlite3": "^3.1.8"
}
}
The output of the npm install is the following:
And I run the following command to check the version of Electron:
node_modules/.bin/electron -v
and the output is '1.6.2' which is the latest version of Electron.
What's more interesting is that I can install the old version of Electron successfully by directly running the following command:
npm install electron#1.4
So I want to if there is anything wrong in my package.json file which caused this problem. And if so, how can I fix it.
Actually, the Electron version 1.6 satisfies "^1.4" because the caret tells NPM the minimal version of the package to install.
As also written in an answer to the Microsoft issue on GitHub, you might use "1.4" or "~1.4.0" in order to get Electron 1.4 or any other 1.4.x version (the tilde is for minimal minor releases as shown in the NPM documentation for the cli-based update of packages).
I am having problems installing bower dependencies on a Windows installation. Installation fails for me on Windows 7 x64, with git 2.6.4.windows.1, node v5.4.1, npm 3.3.12, bower 1.7.2.
It works for a colleague on OSX (git 2.5.4, node v4.1.1, npm 2.14.4, bower 1.5.3) and for a colleague on Windows 10 (git 2.5.0.windows.1, node v4.2.2, npm 2.14.7, bower 1.3.11).
The error message I am getting basically tells mit that bower-angular-translate does not have a version tag that satisfies 2.8.1, but the GitHub repository does have a version 2.8.1.
The failing packages are angular-ui-router, angular-local-storage and angular-translate.
I tried downgrading node to 0.10.x and 4.x.x and reinstalling bower, both did not work.
If anyone has experienced the same error message behavior with bower (on windows?) and has successfully solved it, any pointers would be greatly appreciated.
The error message after running bower install:
bower angular-translate#~2.8.1 ENORESTARGET No tag found that was able to satisfy ~2.8.1
Additional error details:
No versions found in git://github.com/PascalPrecht/bower-angular-translate.git
My bower.json:
{
"name": "My App Name",
"version": "0.0.1",
"dependencies": {
"angular": "1.4.7",
"angular-animate": "1.4.7",
"angular-aria": "1.4.7",
"angular-cookies": "1.4.7",
"angular-resource": "1.4.7",
"angular-sanitize": "1.4.7",
"angular-material": "0.11.2",
"angular-ui-router": "0.2.5",
"angular-local-storage": "0.2.x",
"angular-translate": "~2.8.1"
}
}
Just in case, my package.json:
{
"author": "My Name",
"name": "My App Name",
"version": "0.0.1",
"dependencies": {},
"devDependencies": {
"chai": "2.2.0",
"gulp": "3.9.x",
"gulp-angular-filesort": "1.1.1",
"gulp-bower-files": "0.1.x",
"gulp-clean": "0.2.x",
"gulp-debug": "2.1.x",
"gulp-concat": "2.2.x",
"gulp-filter": "1.0.x",
"gulp-inject": "0.4.x",
"gulp-less": "1.2.3",
"gulp-livereload": "1.3.x",
"gulp-tsc": "0.10.x",
"gulp-uglify": "1.2.x",
"gulp-util": "2.2.x",
"gulp-watch": "0.6.x",
"karma-coverage": "~0.2.4",
"karma-mocha": "~0.1.6",
"karma-phantomjs-launcher": "^0.1.4",
"karma-sinon-chai": "~0.2.0",
"merge-stream": "0.1.x",
"mocha": "~1.20.1",
"phantomjs": "^1.9.17",
"q": "1.0.x",
"run-sequence": "0.3.x"
}
}
GitHub revoked my SSH keys, causing git clone to fail.
Since cloning repositories via git clone --branch <tagname> https://<repo> at the "missing" tag worked, I understood from the error message that bower was not able to find the tag.
Both my bash from msys-git and my cmd.exe were set up to use Putty's plink.exe, while bower was trying to connect via OpenSSH. Putty was set up with the correct private key, OpenSSH was not.
The culprit here was GitHub, which removed my SSH public key from my profile, making git clone via SSH (which is the default for bower install) fail with a Permission denied (publickey).
The combination of GitHub not sending me a notification email about this and the bower error message describing an entirely different error made error-tracing this a nightmare.
Kudos go to Andra for the comment to use git config --global url."https://".insteadOf git://. While not suitable as a permanent solution (my company's git server enforces SSH, since it is superior to a simple user-password combination), it helped limit the problem to the SSH access.
Try to change the git protocol from git to https by executing:
git config --global url."https://".insteadOf git://
I listed (and/or installed) several dependencies with Bower inside the bower.json file and/or with
bower install https://github.com/username/project.git
That worked fine.
Now I can list all them with
bower list
and then I can pick the name of each dependency of my project and run
bower update dependency-name
Question: How can I bulk update all of them? Or do I have to write a shell script to loop through and update them?
You can update all by running bower update.
Use the -h flag on any command to see how you can use it. Eg bower update -h.
This process is a little slow but is secure because you can realize when your app gets broken.
lets say that you want to update bootstrap you just need to run bower install --save bootstrap and you bower.json file will be updated
Before
{
"name": "my-awesome-app",
"version": "0.0.0",
"dependencies": {
"bootstrap": "~3.0.0",
"requirejs": "~2.1.11",
"modernizr": "~2.8.2",
"jquery": "~2.1.1",
"underscore-amd": "~1.5.2",
"backbone-amd": "~1.1.0",
"require-handlebars-plugin": "~0.8.0"
}
}
After
{
"name": "my-awesome-app",
"version": "0.0.0",
"dependencies": {
"bootstrap": "~3.3.1",
"requirejs": "~2.1.11",
"modernizr": "~2.8.2",
"jquery": "~2.1.1",
"underscore-amd": "~1.5.2",
"backbone-amd": "~1.1.0",
"require-handlebars-plugin": "~0.8.0"
}
}
Used bower-update-all to update all bower dependencies in bower.json, as follows:
npm install -g bower-update-all
bower-update-all
If you want to force all dependencies to update you can use bower install --save --force. This is the same as bower install --save [dep1] [dep2] ...
The short version is bower i -S -f
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.
I have a project that depends on both:
jquery ~1.9.1
another project which in turn depends on jquery >=1.7.2
But when I run bower install, it ends up installing jquery 2.0.2.
This seems broken.
How do I either (a) make it correctly solve the constraints or (b) explicitly force a final version to be installed (workaround)?
You can add resolutions to the object in your bower.json file and specify the component name & version to automatically resolve the conflict when running bower commands.
Like this:
{
"name": "project-x",
"private": true,
"dependencies": {
"bootstrap-sass": "~3.3.7",
"modernizr": "~2.8.3",
"jquery": "~1.11.3"
},
"devDependencies": {},
"resolutions": {
"jquery": "~1.11.3"
}
}
Also you can run bower install and when bower will ask for "suitable version" (if interactive mode is on), prefix choice with !, so bower will save your choice into bower.json file.
use --force-latest
enter link description here