Search code examples
yarnpkg

Yarn - remove package best practices


If you want to remove a package using Yarn should you:

  1. run yarn remove [package]

or

  1. delete it from package.json and run yarn install

Do both work the same? Will #2 update yarn.lock?


Solution

  • If you run yarn remove [package] it will remove the package from node_modules and also from the yarn.lock file.

    If you manually delete from package.json and then run yarn install, the deleted package is not installed and the yarn.lock file is not updated.