Resolution Bower versions conflict - bower

Situation I have is described here: How to resolve Bower dependency version conflicts?
The problem is that proposed solution does not work. Adding a resolution section to bower.json does nothing and it still requires to choose package version manually on each installation.
But, surprisingly, when I install bower packages though Grunt (with grunt-bower-task), it just works, even without resolutions.
I have the latest bower version (1.4.1 for now).
Does anybody know what's going on and is it possible to make bower to install without manual resolution?

You can use "--save" or "--save-dev" when you install and resolve these conflicts - in this way, bower will update accordingly the json file. Next time when you run bower install, bower will read the written sections and will not ask you any more.
No need for manual edits - unless you know what you're doing.

Related

TFS does not allow the NuGet packages to be installed/Updated

I am in VS2015/TFS environment and I have been having this constant issue with TFS Source Control:
Every time I want to install the package, it fails with following error
Install failed. Rolling back... Package 'jQuery.Cookie 1.4.1' does not
exist in project 'Web'
This is the same exact error that I see every time I try to install any of the packages.
Currently, I have been taking a copy of my project folder and then put it somewhere where I do not have any SourceControl, then I install the package and copy it back to its original location
The only problem with this approach is that it is a lot of tedious work everytime I want to install a new package
Also, all the packages installed in this manner are not recognized by the source Control and that is why I have to add each file saperately. Not to mention that since it is not as accurate as having Nuget taking care of everything for me, sometimes I miss to check in some of the files and it breaks things on the server.
Can someone guide me on how can I smoothly install an new NuGet package on VS 2015 without having to go through this tedious process?
It seems to be caused by the bug in old nuget version: Install package fails when solution/project is bound to TFS source control
Update nuget to latest version and then try again.

how do I specify the installation location of a bower package?

I'd like to use bower in install packages. I'd also like to have the packages in specific places. In particular, I'd like my javascript in '/js'.
You can set a custom directory for where you would like bower to install all the listed dependencies in the bower.json file. Here's a quick from bower's documentation of .bowerrc:
Custom install directory
A custom install location can be set in a .bowerrc file using the
directory property. The .bowerrc file should be a sibling of your
project's bower.json.
{
"directory": "public/bower_components"
}
One of the benefits of Bower is how simple it is. One of the main downfalls of Bower is how simple it is. I do not believe that bower supports setting custom install locations for each dependency. You may have to rely on another tool to do that.
Here's a similar Stack Overflow question about install bower dependencies to different folders. While bower itself is not able to do what you ask, there are a number of tools that add such functionality:
npm bower installer (using npm)
grunt bower task (using
grunt)
grunt bower organizer (using grunt)

MVC Nuget Installing Multiple Packages

I'm building a new solution/project. I copied all the files over and moved all the packages over to the packages folder. When I reference them via nuget, it says they are installed, but
they are not. If they were, I would see them in the installed tab.
First why does it say installed, next how can I install multiple packages at once, instead of
doing it individually. I have like 10+ packages I need to install. This is pain in
the ass, if I have to install each individually. We should be able to run a command that
checks to see if all the packages in the package folder have been installed, if not, install them. Is there a command for this?
Use nuget.exe for this. see following question and google search
nuget install packages.config
Or with NuGet 2.7 you can restore allpackages in the solution using the command line.
nuget restore YourSolution.sln

How to update scripts with bower?

I've created an issue/question about this on
Github but it didn't
receive any attention, except just more people wondering the same
thing, so I decided to try my luck on StackOverflow.
Q: How do you update your bower ?
My problem:
I had Packery 1.0.6 Installed and when I ran bower update it just scanned the directories and didn't update anything at all.
Then I edited the bower.json file and removed Packery 1.0.6 from dependencies and ran:
bower install packery
That confused bower a little, and it asked me which version I wanted - I selected 1.1.2 and now I have 1.1.2.
Why didn't it update to 1.1.2 in the first place ? How can I trust Bower that I have the latest version of everything installed ?
On top of that, running bower update packery doesn't work as well. I thought bower is supposed to be the magical package manager that takes out the hassle of keeping my packages up to date, but as it turns out - it doesn't do much besides installing new packages...
Bower will automatically install your packages with the notation ~x.x.x. It's based on Semantic Versioning and it's package notation.
It doesn't update everything, because it will respect your app's requirements. In your case:
~1.0.6 := >=1.0.6-0 <1.1.0-0
The change from the ~1.0 to ~1.1 could potentially be breaking, and Bower is not willing to update you package unless you are ok with it. Consider it more of a protection.
If you have your bower.json file set as
>= 1.0.6
It should get you nothing less than 1.0.6.
Check out the ranges section on this page.

How to upgrade existing project scaffolded with Yeoman

I used generator-angular a few months ago to scaffold a project and the whole ecosystem (karma, Node versions, grunt packages) has moved on quite significantly. I keep running into problems running tests, building things, and so on.
I know I can use nvm to downgrade my Node version and install older packages, but that kind of sucks, especially when there are many developers on the team. I have used the generators for 10+ projects over the past few months so I'm very interested in a solution.
Is there a recommended upgrade path for when new versions of generators are released, apart from just regenerating the project and copying files across?
(Just to note: this isn't a problem with upgrading a Yeoman 0.9 project.)
First make sure you have committed everything or have a backup, then just scaffold out over the project again. yo will ask you for each file if you want to overwrite. For those files you haven't edited, just say yes. For the other ones, type d for diff and see what's changed. Then manually do the changes, and run npm install & bower install to get the latest dependencies.
EDIT
As mentionned in comments by Markus Gattol :
yo <generator-name> now already run bower install & npm install i.e. no need to run them explicitly again – Markus Gattol

Resources