Install latest version of packages with npm - javascript

It seems if I use npm install --save <package_name>, it installs the latest stable version.
I want to install the absolutely latest release. So if I, for instance, want to install Bootstrap v4, I need to do npm install bootstrap#4.0.0-alpha.6 instead of just npm install bootstrap.
But if I didn't know that the latest version is named 4.0.0-alpha.6, I wouldn't be able to install it. Is there a flag or something else I can use to make sure I get the latest version?

You need to use the #next keyword to get the latest alpha/beta releases of a package.
In your case, it will be,
npm install bootstrap#next --save
Hope this helps!

Try:
npm install bootstrap#next
This way you can install alpha/beta releases.

Related

After installing angular 12 still it is showing 13 version

Mistakenly installed angular prelease version.
Now unable to uninstall the prelease version and install stable version.
Its seems like you have installed angular 12 on specific project.
If you want to install the specific version of angular globally, you need to uninstall current version of angular (if you have already installed), then you can install angular version as per required.
To uninstall the current version of angular cli: npm uninstall -g angular-cli
To install specific version of angular globally: npm install -g angular-cli#ANGULAR_VERSION
Here ANGULAR_VERSION means angular version that you are going to install. Please replace ANGULAR_VERSION with angular version (e.g. 10/11/12/13).
In your case if you want to install angular 13 globally then you can use: npm install -g angular-cli#13

npm install vs npm install <library>

At work we had problem that wasn't displaying icon (from rc-menu lib) for menu block
Each time when we are running
mvn install
we are also running
npm install
inside package json we had this library
"rc-menu":"^5.10.0"
The way to fix it was to run
npm install rc-menu (Inside package.json directory)
My question why this solution works?
For me it is impossible but maybe I'm missing something?
Your version must be a missmatch.
With npm install {package_name} you are installing the latest version. And with npm install you are installing version that satisfies rules of your package.json.
As far as I can see that module doesn't have 5.10.0 version at all...
5.0.14 is the latest of 105 releases
You can try to see the version of that module if you install it with npm install by typing npm list afterwards.

node-sass installation issue

When I try to install node-sass using npm, I get the following error message:
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":"
The command I use is:
npm install node-sass --save-dev-
You can see more details in the screenshot below:
After struggling , finally found exact solution.
In node js software folder, node-sass\4.5.0 folder is still created in npm-cache folder. So I download win32-x64-48_binding.node manually, put it in C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.5.0 folder.
And run npm install command, issue resolved.
I see you are running node version 8.1.4. You can also check it using node --version in the command prompt.
You'll have to use a version >= v4.5.3 instead because lower versions of node-sass are incompatible with node8. This issue has been reported on their GitHub issue page.
You either have to define using v4.5.3 instead or pass the the -g parameter while installing it, which seems to fetch the latest version automagically.
when i used -g it worked properly and got the latest version
Also, as #javiergarval has pointed out, you have a typo. It should have been --save-dev instead of --save-dev-.
My problem is, that I need an older node-sass Binary, which is not available for the new node version I have. But the solution is, at least on Windows, pretty simple. Just install the windows build tools. With that, npm is able to build the binaries out of the source.
Long story short, this solved the problem for me:
npm install --global --production windows-build-tools
Thanks to the answer on this question:
node-sass installation issue on windows 10
Depends on which node version you are using. Node-Sass currently supports only these versions:
Supported Node.js versions 0.10, 0.12, 1, 2, 3, 4, 5, 6 and 7.
If you happen to work on one of those versions, try to specify which version of node-sass you want:
$ npm install --save-dev node-sass#4.5.3
your npm is trying to download node-sass version 3.31.1 which is does not exist on the releases page of https://github.com/sass/node-sass/releases
You have an error on your command:
$ npm install node-sass --save-dev-
^^^
Should be
$ npm install node-sass --save-dev
(without the last - on dev)
Also, it is giving you a WARNING because it wants to be installed globally.
See the official node-sass documentation.
And also, could be interesting for you to know the differences between --save and --save-dev.
version mismatch with node could be the issue. To install the working node-sass version, you can use
npm uninstall node-sass
npm install node-sass#4.14.0
remember to choose your version number based on the following table, and the node version you have, which you can check by the command node --version
You can find full info here
While searching for the solution, have checked the release versions of node-sass and found that "https://github.com/sass/node-sass/releases" the node file it was looking is committed in the latest release and not in the older version. After downloading the required file "win32-x64-64_binding.node" manually from the released version and placing it under C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.7.2 or simply by using npm install node-sass#latest works for me.
None of the above solutions worked for me, this is what I did:
Installed C++ build tools for Visual Studio
Then:
npm uninstall --save-dev gulp-sass
Under the same circumstances I tried to install the node-sass package. I got the error that it required different version. The culprit turned out to be the fact that I was installing not under client folder but in the main one.
After that I installed the appropriate version for Node (for example 12 -> 4.12) based on the answer from Error: Node Sass version 5.0.0 is incompatible with ^4.0.0

c9.io - npm installs outdated packages

I have a workspace on c9.io, and I am using node.js. I am trying to update socket.io from 0.9.17 to the latest version. However, whenever I run the command npm update socket.io it installs the same version. How can I fix this?
To install the latest available package:
npm install <package>
To install a version directly (no need to uninstall first):
npm install <package>#<version>
If you're not sure what versions of a package are available, you can use:
npm view <package> versions
Don't forget the --save flag to add dependencies to your package.json file.
Source: How do I install a previous version of an npm package?
About npm update
However, if app's package.json contains:
"dependencies": {
"dep1": "~1.1.1"
}
In this case, running npm update will install dep1#1.1.2. Even though the latest tag points to 1.2.2, this version does not satisfy ~1.1.1, which is equivalent to >=1.1.1 <1.2.0. So the highest-sorting version that satisfies ~1.1.1 is used, which is 1.1.2.
Source: npm update - Tilde Dependencies

How update Sails.js to newest version?

How can I update my Sails.js framework (installed on OSX) to newest version using terminal/command line?
To update to the latest stable version:
npm update sails
or, if you've installed it globally, it would be:
sudo npm update -g sails
to install globally. This will overwrite any existing install.
npm update [-g] [<name> [<name> ...]]
This command will update all the packages listed to the latest version (specified by the tag config). It will also install missing packages.
If the -g flag is specified, this command will update globally installed packages.
So for you, I guess that would be: npm update sails or sudo npm -g update sails depending on how and where you installed it.

Categories

Resources