NPM – Installing a local module

Just something I do not do on a regular basis, but might come in handy.

Source: https://stackoverflow.com/questions/8088795/installing-a-local-module-using-npm

Steps:

STEP 1. npm install

STEP 2. npm run build

STEP 3. npm pack
Builds a <package-name>-<version>.tar.gz file.

STEP 4: Move the file to the consumer project

STEP 5: Refer it in your package.json:

"dependencies": {
  "my-package": "file:/./tmp/my-package-1.3.3.tar.gz"
}

STEP 6: Install the packages:

npm install or npm i or yarn
Package is available in your consumer-project's node_modules folder.