How do I install a package with npm with a different/custom module name

Since [email protected] you could install package under a custom module name. [email protected] introduces support for package aliases.

To install a tarball under custom module name use custom-name@tarball-url argument, e.g. install specific express tarball as my-express module:

npm i my-express@https://github.com/expressjs/express/archive/4.16.3.tar.gz

This feature also allows to alias packages published to npm registry:

npm i express@npm:@my-scope/express


In newer versions of npm (6+), its now possible to alias the module name with

npm i <alias_name>@npm:<original_package_name>