NPM is node’s package manager. A package is some piece of code that can be used again. With NPM we can either create our own packages or use other people packages from npmjs.com. Even big libraries like React or Express are nothing but an npm package
Terminology
- The
npmCLI tool to add or remove packages
- The npmjs.com website that lists all the npm packages
To install any node package we have to first initialize our project by running
npm init -y which creates a package.json file that stores our project’s informationNodemon Package
- One famous package is
Nodemonwhich helps to keep our file running whenever we make some changes. It is only needed in development so we install it with that flag
npm install --save-dev nodemon
- Now we need to make changes to our
package.jsonfile
- Now to run:
npm start
Practice Set
- Create a new directory and initialize with
npm init -y
- Then install
parcelas a development dependency usingnpm install --save-dev parcel
- Now create a new file index.html and
style.scssand insert some code in it
- Create entry for parcel inside the
package.jsonfile
"start": "parcel index.html"
- Now parcel will serve this html file and will also transpile the
scssback tocss
🤖 moose wala