Uninstall/Remove package using Yarn
📋 Table Of Content
In this article, we will learn about the best practices to remove packages using yarn.
Yarn ( Yet Another Resource Negotiator ) is a package manager just like NPM which helps us to install and manage dependencies in our projects.
To remove a package / dependency from our project we can take two approaches:
Approach 1: yarn remove package
To remove a package from a project the easy and simple way is we just have to run:
yarn remove [package name]
This command will remove the package from
node_modules and also update the
Approach 2: Deleting it Manually
If you remove it manually by deleting it from the
package.json file and then run:
This will reinstall the node_modules again without the deleted package.
However, it will not update the
So to resolve this issue, you have to first delete the package entry from your
package.json file and then delete the
yarn.lock file and after that run
This time it will reinstall all your node_modules and update the yarn.lock file too.
Conclusion: So you can see, the best practice would be Approach 1 (yarn remove package name). It will delete and update all the files with just one command.
- Check for prime number using for and while loop in Python
- Merge two dictionaries together using python (3 ways)
- Merge multiple JSON objects into one single object in Python
- Python - Check if list is empty or not
- Python - Insert an element at specific index in a list