You can install from folder or git repo, following is npm i -h
.
$ npm i -h
npm install (with no args, in package dir)
npm install [<@scope>/]<pkg>
npm install [<@scope>/]<pkg>@<tag>
npm install [<@scope>/]<pkg>@<version>
npm install [<@scope>/]<pkg>@<version range>
npm install <alias>@npm:<name>
npm install <folder>
npm install <tarball file>
npm install <tarball url>
npm install <git:// url>
npm install <github username>/<github project>
So, this question has two solution:
1. Install from folder
git submodule add <library repo url> <folder of library>
npm i file:<folder of library>
2. Install from git remote repo
npm i <library repo url>
Or include commit-ish.
npm i <library repo url>#<commit-ish>