Categories
Basic

NPM: install local module

Sometimes we might want to test a local developing module with another local project before merge and release the new version.

Here’s the method we could achieve it:

Step 1: in module project, execute npm pack:

This will build a <package-name>-<version>.tar.gz file.

Step 2: refer it in package.json of consumer project:
"dependencies": {
    "my-package": "path-to-compressed-file"
}
Step 3: Install the package
npm install

Ref: https://stackoverflow.com/a/59766644

Leave a comment