Skip to content

Instantly share code, notes, and snippets.

@pavankjadda
Last active October 20, 2021 16:33
Show Gist options
  • Save pavankjadda/6cd081b4b0fee550c40fc0a380ba5f71 to your computer and use it in GitHub Desktop.
Save pavankjadda/6cd081b4b0fee550c40fc0a380ba5f71 to your computer and use it in GitHub Desktop.
Test Npm package locally.md

Testing NPM packages locallly may not work always. Here are the steps that can be fixed

  1. Go to library directory and execute the following command to link the library to global NPM modules
$ npm link 
$ npm link
  1. Now go to project directory and use the linked package (twice)
$ npm link <package_name>
$ npm link <package_name>
  1. If the above step does not work, delete node_modules and install dependencies and run again
$ rm -rf node_modules/
$ npm install
$ npm link <package_name>
$ npm link <package_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment