Node.js

Uninstall Node.js completely

Remove Node.js, npm and their leftover folders, ready for a clean install.

  1. Uninstall Node.js
    Terminal
    brew uninstall node
  2. Remove npm's cache and global packages
    Terminal
    rm -rf ~/.npm ~/.npm-global

    Used nvm? Also run rm -rf ~/.nvm and delete the nvm lines from ~/.zshrc.

Check it worked

  1. Check it's gone
    Terminal
    node --version

    You should see command not found.

  1. If you used nvm: remove it and every version
    Terminal · Ubuntu / Debian
    rm -rf ~/.nvm ~/.npm

    Then delete the nvm lines at the end of ~/.bashrc.

  2. If you used apt: remove that insteadNeeds sudo
    Terminal · Ubuntu / Debian
    sudo apt purge -y nodejs && sudo apt autoremove -y

Check it worked

  1. Check it's gone
    Terminal · Ubuntu / Debian
    node --version

    Open a new terminal. You should see command not found.

  1. Uninstall Node.js
    PowerShell
    winget uninstall OpenJS.NodeJS.LTS
  2. Remove npm's leftover folders
    PowerShell
    Remove-Item -Recurse -Force "$env:APPDATA\npm", "$env:LOCALAPPDATA\npm-cache" -ErrorAction SilentlyContinue

Check it worked

  1. Check it's gone
    PowerShell
    node --version

    Open a new PowerShell window. You should see an error.