How to change version of one package during instalation - npm

I don't know how to ask. I hope u will understand. I have the following problem: I am trying to install packages for my project but I want to change the version of "sharp" package. Npm is trying to install y version and i want to install x version. How to change it??

Related

npm rebuild, electron-rebuild doesn't use special parameters

I have an electron/React app running. So after I install all packages I have to execute electron-rebuild so there are no version issues.
I install one package in the preinstall script: npm install better-sqlite3 --build-from-source --sqlite3=my sqlite amalgamation folder
Now the problem is that electron-rebuild/npm rebuild just installs better-sqlite3 and not better-sqlite3 with my customized amalgamation.
This makes it unusable for me because I need my customized version of sqlite.
Does anyone know how to solve this, how to make electron-rebuild/npm rebuild install that package with the extra parameters?
I created a library to fix this issue/get around it: https://www.npmjs.com/package/better-sqlite3-sqleet.
So the problem is solved for me, but it would be nice to still have an answer on the original question.

Is npm install package#latest stable or does it also include alpha/beta version?

I just want some confirmation as I've always been using #latest for a while with my packages and want to know if I'm really installing a stable version or can possibly install a alpha/beta version of the package.
I'm pretty sure this is meant for stable versions as they tell you to install#latest for npm (unless it's special syntax like npm start).
The more I think about it, the more paranoid I get, any confirmation would be greatly appreciated. :)
Using npm install <pkg>#latest is equivalent to using npm install <pkg> by itself or listing * as the dependency version in package.json. npm documents this here:
npm install will use the latest tag by default.
So in practical terms, latest is semantically equivalent to stable.
However, if a prerelease version of a package is published to npm without specifying a prerelease tag such as --beta or --rc, that version becomes the latest by default:
By default, npm publish will tag your package with the latest tag.
As a result, it's possible to mess up and publish a prerelease version that will be installed by default. This happened to Bootstrap in late 2015.
This article from early 2016 by Mike Bostock explains how even specifying alpha or beta as part of the version number won't prevent npm from making that version the latest.
So unfortunately if you want to be certain that you get only stable versions, you need to monitor this manually or trust the package developers to always specify a prerelease tag for non-stable versions.
You can also view the tags assigned for a package like this:
$ npm view express dist-tags
{ latest: '4.16.2', rc: '4.0.0-rc4' }

how can i get what version is my flux via CMD?

I have installed react-native-router-flux for my learning project. i need to know what is the exact version of that, so on my project folder I used react-native-router-flux -version but it didn't work. how can i get what version is that via CMD?
If you are using npm as a package manager, you can type npm list react-native-router-flux. Similarly, if you are using yarn you can type yarn list react-native-router-flux.
You can use yarn outdated or npm outdated to see your package that are out of date. if a package is not in this list it means that you are using the last version of that package.
By using yarn outdated you can see the current version, wanted version and the latest version of each package.

Trying to install grunt-cli, but need help to upgrade to lodash#^3.0.0

I was working through the Thinkster Angular/Firebase tutorial and in the installation process I got to the part where I needed to install grunt-cli with this command in the terminal:
npm install -g bower grunt-cli
and got this error:
lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^3.0.0.
How do I upgrade my lodash?
This is probably because of the dependency chain. I guess grunt is still stocking to the older version of lodash. I think you should be fine as long as grunt is supporting it.
You find more info on this at https://github.com/Azure/azure-mobile-apps-js-client/issues/20

How to tell if npm is fully updated

I'm on Mac OS. When I run sudo npm update -g, I get a whole ton of output dumped out. Nothing actually says anything like "no updates needed," or "updated X, Y, Z." How do I know if all of the packages I've installed are up to date?
I'm sure there's a npm -v command that you can use to check the version against what's on the website.
If you want to see the versions of the packages themselves, that question is answered over here:
npm list for local packages or npm list -g for globally installed packages.
Then you can check those versions against what's on the registry.
Find the version of an installed npm package