Uninstalling packages
suggest changeTo uninstall one or more locally installed packages, use:
npm uninstall <package name>
The uninstall command for npm has five aliases that can also be used:
npm remove <package name>
npm rm <package name>
npm r <package name>
npm unlink <package name>
npm un <package name>
Before npm 5, uninstall left package.json unchanged unless you passed --save (shorthand: -S). From npm 5 on, npm uninstall removes the dependency entry without that flag. The flag is still accepted:
npm uninstall --save <package name>
npm uninstall -S <package name>
For a development dependency, use the --save-dev flag (shorthand: -D):
npm uninstall --save-dev <package name>
npm uninstall -D <package name>
For an optional dependency, use the --save-optional flag (shorthand: -O):
npm uninstall --save-optional <package name>
npm uninstall -O <package name>
For packages that are installed globally use the --global flag (shorthand: -g):
npm uninstall -g <package name>
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents