How to install package using npm
In order to install any package using npm, first we need to make sure that we have already install node in our system.
To check node version, run below command in your command prompt:
node --version
Follow below steps to install and use JS package using npm:
1. Create a folder and inside that folder open git bash and run below command:
npm init
this command will create node_modules folder as well as the package.json file in your folder.
2. Run below command to install specific package:
npm install package-name
such as npm install mathjs
3. Create a JS such as index.js and put the js code in this file and save it.
4. Execute the JS file using below command:
node index.js
Comments
Post a Comment