How does NPM handle Conflicts with Sub/Transitive Dependencies - node.js

I've just discovered (for myself) that NPM doesn't work like other package management systems I've used in the past. My basic understanding of things is that each of my dependencies will also have its own node_modules folder with it's own dependencies (and, with more recent versions of npm, that this second node_modules folder will only be created when there's a version conflict)
This seems pretty neat, but I'm left wondering how npm handles -- sub-sub? -- dependency conflicts. I apologies for not having a better grip on the language -- but here's what I mean.
I want to install version 3.0 of #foo/bar into my project.
A second-package -- let's call it #second/package -- I have wants to install version 2.0 of #foo/bar.
I now understand how this is possible with NPM. The #second/package will have it's own node_modules folder with version 2.0 of #foo/bar
./node_modules/#foo/bar # version 3.0
./node_modules/#second/package/node_modules/#foo/bar # version 2.0
However --
I also want to install version 8.0 of #zip/zap.
But #second/package wants install version 7.0 of #zip/zap.
And version 2.0 of #foo/bar wants to install version 6.0 of #zip/zap.
./node_modules/#foo/bar # version 3.0
./node_modules/#zip/zap # version 8.0
./node_modules/#second/package/node_modules/#foo/bar # version 2.0
./node_modules/#second/package/node_modules/#zip/zip # version 7.0
# where does version 6.0 of #zip/zap go?
Where does version 6.0 of #zip/zap end up? Does npm create a third level node_module folder, or does it give up and say it can't resolve this dependency tree? Or some third thing? Or is my understanding of npm still flawed?
Before I go and figure out how to setup my own npm repository with fake packages to test this out, I thought it'd be better to ask.

NPM, to my surprise, just does the right thing and continues to nest sub-dependency dependencies. i.e., the answer the question
where does version 6.0 of #zip/zap go?
is
./node_modules/#second/package/node_modules/#foo/bar/node_modules/#zip/zap

Related

Package.json has a version of a Package that doesn't actually exist. what happens?

I'm supporting a project that has a version of the following package.
https://www.npmjs.com/package/vue-typeahead-bootstrap
the version in the package.json says we imported version 2.6.0 however the lastest version currently is 2.5.3 beta. I would have to assume someone manually changed this. So if the version specified is beyond the version that currently exists, is it smart enough to just take the latest version. and will it automatically update the the newest version until it hits 2.6.0?
I'm gonna just change it match the current version anyway, but I was curious if anyone knew the functionality of this.
Please look at versions of this package
The version 2.6.0 goes prior 2.5.x versions

What is the difference between GitVersion.Tool and GitVersionTask

I see that there are two nuget packages GitVersion.Tool and GitVersionTask
What is the difference between the two and what to use when.
I also see that GitVersion, but looks like this is deprecated, because the last update was two and half years ago. So lets ignore that.
I believe I am right in saying that the GitVersion package can be ignored. This is no longer used, or recommended.
GitVersion.Tool is a .Net Global Tool version of GitVersion. You can install this using globally on your machine using the following:
dotnet tool install --global GitVersion.Tool
This requires the prior install of the .Net Core CLI tools in order for it to work. With both of these things installed, you can then run dotnet-gitversion to assert the version number of your repository.
GitVersionTask is a NuGet package that you would add to your project within Visual Studio. It includes MSBuild Targets which runs GitVersion during the compilation stage, asserting the version numbers of the repository, which can then be used in other parts of the MSBuild build.
GitVersion.CommandLine is similar to the GitVersion.Tool package, with the exception that this is intended for use with full .Net Framework, and not .Net Core.
GitVersion.portable is essentially the same as the GitVersion.CommandLine package, but it is shipped as a Chocolatey package. This means that you can install is globally on your machine using the command:
choco install gitversion.portable

Does it matter what versions of Angular third party modules installed via npm use?

I have an Ionic4 app using the most current version of Angular7. I installed a few node modules from third parties via npm install --save. The npm modules I installed via npm use Angular4 (when I look through the modules package.json on git), but my main Ionic app uses Angular7. Am I using 2 versions of Angular in my Ionic app and bloating it?
The simply answer is no, it doesnt matter what version of angular third party vendors use. Generally if a library how built using Angular 4 it can be consumed in an newer version of Angular eg) v6, v7 etc. One thing to look out for is the packages that you are consuming in your application, if a package was built with Angular 4 its a high possibility it contains other dependencies that was used and in some cases those packages that were used to build that library may come up as deprecated in newer versions of Angular.
To answer your comment, the answer is yes again; generally if you are using a newer version of Angular you should use the newer packages but if you do use a library that uses an older package, angular will adapt to the specification of that particular package.
Mark as answer is it helped, thank you.
IMPORTANT* when you are upgrading from the current version of angular to an advanced one, you should always install (using NPM install) the angular libraries first and only then the third party packages otherwise it could stuck your installation process and give you strange 'gyp-node' errors.
I think your app is working because ionic was made out of angular, as far as i know, one thing i could recommend to you, apart from the fact that you are asking one thing on the title of your question and then asking something else on your description, is to use NVM.
Stuff like angular, npm and ionic will be linked to your node version, so you could work with two different versions of node and all of the other stuff will not get mixed up, i really hope this helps you a little.

How to install latest ionic2 components

I am currently using ionic2 to try creating a cross plattform app. I know that ionic2 still is under heavy construction and that things (may) change at any time.
Still i wonder how I could install the latest components/api stuff from the nightly builds (or whereever they reside).
I am especially referring to the infiniteScroll Component that is mentioned in the API-Documents of ionic2.
Since i don't understand the layout of the components inside my project fully, i checked where i could see some of them in the directory structure. If i get this right, they all reside in <projectHome>/node_modules/ionic-framework/components?
At least lots of the components mentioned in the documentation above are listed there.
But as i can't find the infiniteScroll Component there, i would like to get some hints on how to install this (and the other missing ones) either by directly giving the respective commands or by pointing to appropriate documentation (i simply did not find anything although searched quite a while for it).
ionic info shows:
Your system information:
Cordova CLI: 6.0.0
Ionic Version: 2.0.0-beta.1
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: 1.7.0
ios-sim version: 4.1.1
OS: Mac OS X El Capitan
Node Version: v5.6.0
Xcode version: Xcode 7.0 Build version 7A220
Sir,
Ionic made some changes in their latest commit. You could see the changes here in the changelog. (Mar 1)
The components are not present in 'ionic-framework/ionic' anymore and they are now present in 'ionic-angular'.
Infinite scroll was added in the release 2.0.0-beta.2, whereas you use the previous release 2.0.0-beta.1 So you might not be able to add it. You could change your package.json to reflect the latest version like shown below.
"ionic-angular": "2.0.0-beta.2",
I would recommend you to read the changelog as it would give a better idea. Hope this was helpful. Thanks.

Groovy plugin installation fails in STS 2.5.2 and 2.7

I have tried installing Groovy plugin via STS's dashboard install feature in both 2.7 (the version I downloaded initially which was the latest version at the time). My colleague recommended downloading 2.5.2, the version he is using, so I did; however the Groovy plugin installer still fails. It starts with:
Cannot complete the install because of a conflicting dependency.
Software being installed: Groovy-Eclipse Feature 2.5.2.xx-20110808-1400-e36 (org.codehaus.groovy.eclipse.feature.feature.group 2.5.2.xx-20110808-1400-e36)
Windows 7 64B
groovy v 1.8.2
grails v 1.3.7
jvm 1.6.0_26
Greatly appreciate any hints/recommendations/ideas. THANK YOU!
Make sure that your STS install is in a directory where the current user has write permissions. Also, there is a problem with installing into the Program Files directory (it is not really writable, even if you think it is).
The reason for this problem is the feature patch that comes with Groovy-Eclipse must be installed into the same directory as the rest of STS (an Eclipse limitation). This patch is the thing that patches the jdt compiler so that it can also compile groovy code.

Resources