npm not installed latest version of package even after using caret(^) - javascript

I have added a package(X) as follows in package.json file
package(X): "^5.0.0"
now the latest version of package(X) is 5.0.1. According to my understanding this should install 5.0.1 but it installs version 5.0.0 itself.
Now I have multiple angular projects which are using package(X) and each of them have the same setup. What surprises me is that it works absolutely fine i.e installs version 5.0.1 in some projects and does not in some projects
Here is the info about package(x)
npm library info

It does depend on other packages' dependencies.
If there is a package that requires X to be exactly 5.0.0, then it will install 5.0.0 as it will satisfy ^5.0.0.
If there isn't one, then it will install whichever latest that will satisfy ^5.0.0 which is 5.0.1 in this case.

Related

installation of draw2d latest version on angular 10

how can I install the latest version of draw2d library on angular 10?
I used the command "npm i draw2d" but the version that has been installed is 1.0.38 although the latest version is 6.1 I guess.
enter image description here
thank you.
Actually, you have the latest version of draw2d according to npm :
https://www.npmjs.com/package/draw2d/v/1.0.37
You can also download and add it manually at https://github.com/freegroup/draw2d
To be clear, the version on npm is a package version, not the same that draw2d version of draw2d.org (http://www.draw2d.org/draw2d/).
It creates confusion, I think it's a mistake from the author.
You can test :
npm i draw2d#6.1

What happens when there are multiple versions available in organisation npm

I am fairly new to versioning a library, I wanted to get a clarity on my concern and please explain how does npm work.
I am trying to build a library and publish it to my organization npm registry. Now I have an alpha release which is already available in nexus and I did an npm install and the library works fine.
Now I when I create a stable release and make the library available for my organisation to use, when this happens the version tag will be updated to v1.0.0 and when I do an npm install the latest stable version will be available.
Post this, if I create further more alpha builds the version now has an alpha build tag appended to the version. Now when I do an npm install in a fresh project setup which version will I get:
stable version
new alpha version
I am a new to this, if anyone can explain how npm install will work and what version will I get that will be super helpful.
Thanks
What npm i will do for you, depends on what you stated in package.json.
{
"dependencies":{
"foo":"1.0.0", //match version exactly
"baz":">1.0.2", //must be greater than version
"elf":"~1.2.3", //everything from 1.2.3 to <1.3.0
"thr":"^1.2.3", //from 1.2.3 to <2.0.0
}
}
More details here
If you want to know the exact version of the package installed after npm i you could look it up in package-lock.json

How to install latest STABLE version of a Javascript package via a package manager?

How to install latest stable version of a Javascript package via a package manager?
(no alphas, betas, etc.)
I tried NPM and did not find a solution. This question is similar.
I tried Bower and find nothing. Here is a question with no answer here.
Please help. Which package manager should I choose? Maybe there are another options around?
PS
For example: knockout.js, npm givers beta for latest. I don't want beta! I also would like to set the same limitation for dependencies - pull only stable versions.
Installing a package without specifying a version will always install the latest version published to npm, including pre-releases (alpha, beta etc.):
npm install knockout
However, if you specify the version range, even only as a wildcard *, pre-release versions are explicitly excluded:
npm install knockout#*
See the npm docs for more info. Also, you can test this in npm's semver calculator.

Does package.json "latest" versions include beta?

In package.json you can specify a package to be synced with the latest version:
{
...,
"devDependencies": {
"gulp": "latest",
...
},
...
}
Does "latest" include the alpha or beta versions, or just the latest stable version? I couldn't find definitive documentation on this.
The maintainers get to set the 'latest' tag to whatever they want. To wit:
#mac:~/projects/client$ npm outdated
Package Current Wanted Latest Location
bourbon 4.2.6 4.2.6 5.0.0-beta.2
webpack 2.1.0-beta.4 2.1.0-beta.4 1.12.14
'Latest' is set to the beta on bourbon, but webpack still has the stable as 'latest'.
There's also a tag 'next' that some maintainers use for prerelease version.
By default, NPM dependencies are pulled from the NPM repository. Authors must manually upload new versions of their software to the NPM repository, so the "#latest" version of the code hosted on NPM is different from the latest version of the code that exists anywhere (e.g., on GitHub).
According to the NPM repository's info page on Sails, the latest NPM-hosted version is 0.9.16 while the current GitHub version is 0.10.0-rc3.

How do I downgrade / install a specific version of jspm?

I upgraded to --latest but want to downgrade to a specific version due to compatibility issues.
Just specify the version number like so.
npm install jspm#1.0.0

Categories

Resources