Sekrab Garage

NPM

Reference an npm package from a local folder using npm link

Tip March 11, 21

If you have a package on npm that you want to maintain, and want to use it in a different project, everytime you make a change to the code, you need to npm publish, then in the consumer project, npm update. Well not really.

In the package folder: (my_npm_package/)

> npm link

In the consuming project

> npm link my_npm_package

Now your consumer project is consuming the local version. Don't forget to publish your package though, for other consumers.

To remove link, in consumer project:

> npm unlink my_npm_package