Skip to content

Locally test npm packages before publishing

Jason Zhen edited this page Jul 6, 2022 · 1 revision

Run npm pack. npm pack creates a tarball of your package that can be shared and installed. It's what is uploaded to npm when you publish a package.

~/waterthetrees/tree-id $ npm pack

Make a copy the tarball in any location. Here we move it to the root folder.

~/waterthetrees/tree-id $ cp waterthetrees-tree-id-1.x.x.tgz ~

Install the tarball in the project that uses the package. Or create a temporary project to test the package.

~/waterthetrees/wtt-server $ npm install ~/waterthetrees-tree-id-1.x.x.tgz


Reference: https://blog.vcarl.com/testing-packages-before-publishing/#npm-pack

Clone this wiki locally