-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running yarn install after removing a dep manually doesn't remove it from the yarn.lock #2581
Comments
I think However, PHP's Composer does display a warning when running the install command, and the lock file is outdated compared to the |
When the package.json has been updated to include a new dependency or a new version of a dependency, I think of |
It looks like |
This behavior is especially confusing in light of what Starting with the original repro:
Then do:
Which yields:
I had understood |
Yarn should have behaviour similar to composer. |
you should use |
I think so too. However, as others have pointed out, it was decided in #570 that yarn install would by default recreate yarn.lock to match the list in package.json. The problem is that it is inconsistent, i.e. it only works that way for half changes to the package list.
I like using a editor for editing source files (and package.json is a source file) -- not cat, yarn, etc. -- and then using build/packaging tools to apply those updates. Worse, if I've already removed a bunch of packages, I have to go add them back, and then run yarn remove, or else it won't work. Plus, yarn remove reorders my package.json |
This command will remove xx from package.json but it's left in node_modules and yarn.lock. So that's not a solution. yarn -v 1.7.0 This behavior feels buggy to me. |
When using npm I used to run |
When I delete something manually, usually |
Closing as fixed in v2. |
Do you want to request a feature or report a bug? Bug
What is the current behavior?
Removing a dep manually and then running
yarn install
doesn't remove it from the yarn.lockIf the current behavior is a bug, please provide the steps to reproduce.
yarn init --yes yarn add object-assign sorted-object # manually update package.json to remove object-assign yarn install cat yarn.lock
What is the expected behavior?
It should remove the unused items from the yarn.lock
Please mention your node.js, yarn and operating system version.
The text was updated successfully, but these errors were encountered: