If I install the latest version of node from nodejs.org, how do I install the dependencies that are compatible with the version.
For example of dependencies:
- material,
- animation,
- cdk,
- flex-layout, etc.
How to install using the npm
If I install the latest version of node from nodejs.org, how do I install the dependencies that are compatible with the version.
For example of dependencies:
How to install using the npm
Once node
is installed you can begin using the "node package manager" or npm
.
First you will need to create a package.json
file to maintain your packages.
Navigate to the root of your project folder. Ex:
C/user/repo/my-project
And then initialize the package manager:
npm init
Follow the onscreen instructions and a package.json
will appear in this folder.
Now you will be able to install packages.
Here is an example of how to install material
:
npm install material
or short hand
npm i material
This will install the package in the folder you are running the command.
You may want a global install. Installing globally will give all of your projects access to the package. If you want to install it globally try this:
npm i -g material
-g
mean 'global'
Find out more here: https://docs.npmjs.com/
Many node modules have in their package.json file set on which node version they can work. You can check How can I specify the required Node.js version in packages.json? and npmjs.com/files/package.json#engines how it is done.
So for example, @angular/material has in package.json
this:
"engines": {
"node": ">= 5.4.1"
}
That means that if you have a version of node that is bigger than 5.4.1
a current version of @angular/material
is compatible and it will be installed using:
npm i @angular/meterial
For detailed information about installing modules using npm
you can check npm-install/Install a package.