In order to use NPM, make sure the following is installed node -v npm -v
NPM stands for node package manager. It allows you to manage (install, uninstall, update) project dependencies. When you add a dependency to your project using npm install, it adds the dependencyâs code to the node-modules folder. If you specify âsave, it also records the dependencyâs name and version in your package.json file.
Package.json file contains your projectâs meta data including a list of the dev dependencies.
âdevDependenciesâ: { âbrowser-syncâ: â^2.26.3â, âgulpâ: â^4.0.0â, âgulp-sassâ: â^4.0.2â }
There is also something called package-lock.json. I tried reading up on it but it was over my head. My main take away is that this also needs to be tracked (aka donât gitignore).
Generates a package.json file when you start a project
Use this after you checking out a project repositoryÂ
Installs the version of the dependencies listed in package.json so updates to the dependency donât end up breaking your code
npm install dependency-name âsave
Installs new dependency and adds it to your package.json list
Note If you are only using âbuildâ dependencies (e.g., GULP), there is no need to push it to the server. Therefore, you can add ânode-modules/â to your gitignore folder. However, this means you need to run npm install everytime you check out your repository because it does not contain your dependencies.
Donât install Bootstrap using npm because you need it on the server-side and therefore canât ignore it.
References https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/ https://medium.com/@tanya/what-the-heck-is-npm-b8168f61e3b5