yarn remove: Usage & Common Errors
Uninstall a dependency and update the manifest.
yarn remove uninstalls one or more packages, removing them from package.json and updating yarn.lock and node_modules.
What it does
Deletes the named packages from the appropriate dependency field, re-resolves the graph, and rewrites yarn.lock. It only operates on direct dependencies declared in package.json, not transitive ones.
Common usage
Terminal
yarn remove lodash # remove one package
yarn remove jest @types/jest # remove several at onceCommon error: not specified in package.json
yarn remove fails with "This module isn’t specified in a package.json file" (Yarn 1) or a similar Berry error. You are trying to remove a transitive dependency or a misspelled name. Only direct deps can be removed - check package.json for the exact key first.
Terminal
# confirm it is a direct dependency before removing:
yarn why some-pkgRelated guides
yarn "This module isn't specified in a manifest" - Fix Workspace Resolution in CIFix Yarn "This module isn't specified in a manifest" in CI - code imports a package not declared in the works…
yarn why: Usage & Outputyarn why explains why a package is installed - which dependencies pull it in. The go-to command for debugging…
yarn add: Usage, Options & Common Errorsyarn add installs a package and saves it to package.json. Usage for dev, exact, and peer deps, and the "could…