Link a local package for development

Low risk
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Symlinks a locally checked-out package into a consuming project so changes are picked up immediately, without publishing to a registry.

nodenpmlinkdevelopment

Parameters

The name field of the local package being linked, e.g. my-lib.

Commands

In the library's directory, confirm the package name to link

npm pkg get name

In the library's directory, register a global symlink to it

npm link --ignore-scripts

In the consuming project, symlink the library into node_modules

npm link --ignore-scripts "<package_name>"

Verification

npm ls "<package_name>"

The package resolves to a symlinked local path, not a registry version.

Undo

In the consuming project, remove the symlink and restore the registry version

npm unlink "<package_name>" && npm install --ignore-scripts

Pitfalls

  • Lifecycle scripts are disabled during link and reinstall; packages that rely on build or install scripts may need those run separately after review.
  • Run the second step inside the library checkout and the third inside the consuming project — the order and location matter.
  • A plain npm install in the consuming project silently replaces the symlink with the registry version.
  • Duplicate React (or similar singleton) instances across the link boundary cause invalid-hook-call style errors; align peer dependencies.

Related