[Fixed] Build and use npm package locally


I made some custom modifications in the ngx-mask package and need to test it locally.

How to overwrite the installed npm package?

Currently the package is declared as a dependency in packages.json file as:

"ngx-mask": "^7.8.9"

I do prefer not to fork the original package and not to use github for this, if possible.


If you have made these changes on your machine. (I’m assuming you have)

  1. Run a build of the ngx-mask package that you changed.

  2. navigate to the dist / whatever your compiled output folder is.

  3. run npm pack inside that folder. This creates a .tgz zip file of your package with your custom modifications.

  4. copy that file into the root (you could put it wherever but root makes things easy) of your project.

  5. in your package.json replace the version number ngx mask to the following "ngx-mask": "file:my-packed-file.tgz"

  6. Run an npm install using your new package.json

you should have your modified copy loaded in as a dependency in node_modules.

Leave a Reply

(*) Required, Your email will not be published