npm Link / Unlink - Developing nodeJS/npm packages

The proper way of usage of link and unlink is crucial to maintain development of the packages for big projects. Many times you may notice unexpected results and waste of huge amount of time. (keep in mind --no-save)

Solutions

Standard Linking

cd yourbigproject
npm link /dev/mypackage # your package dev path

# to unlink (--no-save extremely important!)
# you unlinking by passing id of your plugin (the same as it is in the package.json)
npm unlink --no-save nameofyourplugin

Link globally - when you develop/test on multiple packages

Go to your extension folder (development) and link it globally.. Let say it is @nexssp/mypackage

cd dev/mypackage
npm link .
npm ls --depth=0 --link=true -g # should display your linked package

Now go to the project where you want to use linked package

cd mybigproject
npm link @nexssp/mypackage # it will take the

Important of --no-save

If you will unlink without --no-save you will remove package from the package.json!

# important! of --no-save as you may endup removing the package from your package.json file!
npm unlink --no-save @nexssp/package