dhei/classic-tokens
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: removal |
| 3 | section: 7 |
| 4 | description: Cleaning the Slate |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v6 |
| 7 | github_path: docs/content/using-npm/removal.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v6/misc/removal |
| 10 | - /cli-documentation/v6/misc/removing-npm |
| 11 | - /cli-documentation/v6/using-npm/removal |
| 12 | - /cli-documentation/v6/using-npm/removing-npm |
| 13 | - /cli/v6/misc/removal |
| 14 | - /cli/v6/misc/removing-npm |
| 15 | - /cli/v6/using-npm/removing-npm |
| 16 | --- |
| 17 | |
| 18 | ### Synopsis |
| 19 | |
| 20 | So sad to see you go. |
| 21 | |
| 22 | ```bash |
| 23 | sudo npm uninstall npm -g |
| 24 | ``` |
| 25 | |
| 26 | Or, if that fails, get the npm source code, and do: |
| 27 | |
| 28 | ```bash |
| 29 | sudo make uninstall |
| 30 | ``` |
| 31 | |
| 32 | ### More Severe Uninstalling |
| 33 | |
| 34 | Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed. |
| 35 | |
| 36 | If that doesn't work, or if you require more drastic measures, continue reading. |
| 37 | |
| 38 | Note that this is only necessary for globally-installed packages. Local installs are completely contained within a project's `node_modules` folder. Delete that folder, and everything is gone less a package's install script is particularly ill-behaved). |
| 39 | |
| 40 | This assumes that you installed node and npm in the default place. If you configured node with a different `--prefix`, or installed npm with a different prefix setting, then adjust the paths accordingly, replacing `/usr/local` with your install prefix. |
| 41 | |
| 42 | To remove everything npm-related manually: |
| 43 | |
| 44 | ```bash |
| 45 | rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm* |
| 46 | ``` |
| 47 | |
| 48 | If you installed things _with_ npm, then your best bet is to uninstall them with npm first, and then install them again once you have a proper install. This can help find any symlinks that are lying around: |
| 49 | |
| 50 | ```bash |
| 51 | ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm |
| 52 | ``` |
| 53 | |
| 54 | Prior to version 0.3, npm used shim files for executables and node modules. To track those down, you can do the following: |
| 55 | |
| 56 | ```bash |
| 57 | find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ; |
| 58 | ``` |
| 59 | |
| 60 | (This is also in the README file.) |
| 61 | |
| 62 | ### See also |
| 63 | |
| 64 | - [npm uninstall](/cli/v6/commands/npm-uninstall) |
| 65 | - [npm prune](/cli/v6/commands/npm-prune) |