This error occurs when npm fails to create symbolic links during npm link or global package installation. Usually caused by missing directories, incorrect npm prefix configuration, or filesystem limitations.
The ENOENT (Error NO ENTry) with "syscall symlink" means npm is trying to create a symbolic link but can't find the destination directory. This typically happens during `npm link` operations or global package installations. When you run `npm link` in a package directory, npm creates a symlink from your global node_modules to your local package. If the global npm directories don't exist or are misconfigured, this error occurs. This is especially common after upgrading Node.js or npm, when using version managers like nvm, or on filesystems that don't support symlinks (Windows shared folders, some VirtualBox configurations).
First, verify your npm prefix and create missing directories:
# Check current npm prefix
npm config get prefix
# Check if lib/node_modules exists
ls -la $(npm config get prefix)/lib/node_modules
# If missing, create it
mkdir -p $(npm config get prefix)/lib/node_modulesEnsure you own the npm directories:
# Fix ownership (Linux/macOS)
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
# Verify you can write to it
touch $(npm config get prefix)/lib/node_modules/test && rm $(npm config get prefix)/lib/node_modules/testConfigure npm to use a directory in your home folder:
# Create a directory for global packages
mkdir -p ~/.npm-global
# Configure npm to use it
npm config set prefix ~/.npm-global
# Add to your PATH (add to ~/.bashrc or ~/.zshrc)
export PATH=~/.npm-global/bin:$PATH
# Reload shell config
source ~/.bashrcNow npm link and global installs will work without permission issues.
After fixing the directories:
# In your package directory
cd /path/to/my-package
npm link
# Then in your project
cd /path/to/my-project
npm link my-package
# Verify it worked
npm ls -g --depth=0If your filesystem doesn't support symlinks (Windows/VirtualBox):
npm install --no-bin-links
npm link --no-bin-linksThis copies files instead of creating symlinks.
NVM Users: Each Node.js version has its own global npm directory. When you switch Node versions with nvm use, you may need to re-link packages.
Windows Symlinks: Windows requires admin privileges or Developer Mode to create symlinks. Run PowerShell as Administrator, or enable Developer Mode in Windows Settings.
VirtualBox Shared Folders: Enable symlinks in VM settings:
VBoxManage setextradata "VM_NAME" VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1Docker/Vagrant: Symlinks in shared/mounted folders often fail. Either:
- Install node_modules inside the container (not in shared folder)
- Use --no-bin-links
- Use a Docker named volume for node_modules
npm notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm