Can you manually delete the unused dependencies in package.json without using npm uninstall?

Viewed 602

So, im trying to figure out how to remove some unnecessary dependencies, and I was wondering if simply deleting the dependency in the package.json file will suffice? or would I need to use npm uninstall?

2 Answers

npm uninstall basically removes the files and folder and also removes the entry from package.json and package-lock.json

However, if you really need to follow deleting dependency from package.json then you can delete node_modules folder and then do npm install so only fetch dependencies that you really want to keep.

Hi you can just delete the node_modules and dependencies from your package.json and then you can do an npm install - This will remove all packages which are not in the package.json

Related