How to fix npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic link to remove in npm

npmBEGINNERLOWUpdated Dec 5, 2025· 109 views

This error occurs when npm tries to remove a symlink that doesn't exist. Usually because the package was already unlinked, manually deleted, or you're in the wrong directory.

Quick fix

Fixes npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic link to remove

# List globally linked packages
npm ls -g --depth=0

# Check if symlink exists
ls -la $(npm config get prefix)/lib/node_modules/ | grep my-package
  1. Check if the package is actually linked
  2. Verify you're in the right directory
  3. Check for nvm version mismatch
  4. Re-link and then unlink
npm — error
# List globally linked packages
npm ls -g --depth=0
# Check if symlink exists
ls -la $(npm config get prefix)/lib/node_modules/ | grep my-package
npm ERR! code ENOENT
npm ERR! npm unlink could not find a symbolic link to remove

What this error means

The ENOENT error during `npm unlink` means npm is looking for a symbolic link to remove, but it doesn't exist. This happens when: - The package was already unlinked previously - The symlink was manually deleted - You switched Node versions (with nvm) and the symlink is in a different global directory - The original package directory was moved or deleted - You're running unlink in the wrong directory The error is usually harmless—the symlink is already gone. But if you're trying to clean up a broken link setup, you may need to manually verify and fix the state.

Typical symptoms

  • npm unlink fails with 'could not find symbolic link'
  • ENOENT error when trying to unlink a package
  • Package shows as linked but unlink doesn't work
  • Switched Node versions and unlink fails

Common causes

  1. Package was already unlinked
  2. Symlink was manually deleted
  3. Original linked package directory was moved or deleted
  4. Using different Node version than when package was linked (nvm)
  5. Running npm unlink in wrong directory

How to fix "npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic link to remove"

1Check if the package is actually linked

Verify the current link state:

bash
# List globally linked packages
npm ls -g --depth=0

# Check if symlink exists
ls -la $(npm config get prefix)/lib/node_modules/ | grep my-package

If the package doesn't appear, it's already unlinked.

2Verify you're in the right directory

For unlinking, you need to be in the correct location:

bash
# To unlink from your project (removes the local symlink)
cd /path/to/my-project
npm unlink my-package

# To unlink the global link (removes from global node_modules)
cd /path/to/original-package
npm unlink

The error often occurs when you're in the wrong directory.

3Check for nvm version mismatch

If using nvm, check which Node version created the link:

bash
# See current Node version
node --version

# List all Node versions
nvm ls

# Each version has its own global node_modules
ls ~/.nvm/versions/node/v*/lib/node_modules

You may need to switch to the Node version that was used when linking.

4Re-link and then unlink

If the state is inconsistent, re-establish the link first:

bash
# Go to the package directory
cd /path/to/my-package

# Create the global link
npm link

# Go to your project
cd /path/to/my-project

# Link in project
npm link my-package

# Now unlink should work
npm unlink my-package
5Manual cleanup

If automatic unlink doesn't work, manually remove:

bash
# Remove from global node_modules
rm $(npm config get prefix)/lib/node_modules/my-package

# Remove the binary symlink if it exists
rm $(npm config get prefix)/bin/my-package

# Clean up your project
cd /path/to/my-project
rm -rf node_modules
npm install

Advanced notes

Order matters: When unlinking, always unlink from your project first, then unlink globally:

bash
cd /path/to/project && npm unlink my-package  # First: from project
cd /path/to/package && npm unlink              # Second: global link

Use --no-save to preserve package.json: If you want to unlink but keep the dependency in package.json:

bash
npm unlink my-package --no-save

Git branch switching: If you linked a package and then switched to a Git branch where that package doesn't exist, unlink will fail. Switch back to the original branch first.

Safe to ignore: If the error occurs because the link is already gone, you can safely ignore it. The unlink was essentially already done.

Frequently asked questions

What does "npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic lin" mean?
The ENOENT error during npm unlink means npm is looking for a symbolic link to remove, but it doesn't exist. This happens when: - The package was already unlinked previously - The symlink was manually deleted - You switched Node versions (with nvm) and the symlink is in a different global directory - The original package directory was moved or deleted - You're running unlink in the wrong directory The error is usually harmless—the symlink is already gone. But if you're trying to clean up a broken link setup, you may need to manually verify and fix the state.
How do I fix "npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic lin"?
This error occurs when npm tries to remove a symlink that doesn't exist. Usually because the package was already unlinked, manually deleted, or you're in the wrong directory.
What causes "npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic lin"?
Package was already unlinked Symlink was manually deleted Original linked package directory was moved or deleted
Is the "npm ERR! code ENOENT npm ERR! npm unlink could not find a symbolic lin" error serious?
It is a low-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading