16

I have to remove several libraries from the project. Currently worried about what if I remove a library, which is dependency of any other library.

Which approach can safely remove the libraries ?

I see I have two choices:

  1. Edit package.json manually. Remove library entries... Delete node_modules folder and do npm install.

  2. do npm uninstall --save for each package.

What are difference between two, especially when I want to take one step at a time. Without breaking any peer dependencies

1

1 Answer 1

31

There is no difference at all

npm un package_name package_name .... 

will uninstalls a package, completely removing everything npm installed on its behalf

It also removes the package from the dependencies, devDependencies, optionalDependencies, and peerDependencies objects in your package.json and update package-lock.json file also

--save or -S will tell npm to remove the package from your package.json and package-lock.json files. This is the default, you don't have to use it.

--no-save is opposite to --save will tell npm not to remove but uninstall

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.