简体   繁体   English

从 yarn.lock 中删除依赖项

[英]Remove dependencies from yarn.lock

After editing package.json manually (i changed the source url for a dependency) in the yarn.lock an entry was added with the new url but the old one was kept.在 yarn.lock 中手动编辑 package.json(我更改了依赖项的源 url)后,添加了一个带有新 url 的条目,但保留了旧的。 It tried to syncronice it using它试图使用同步它

yarn install

Old entries keep being there Also tried removing them using旧条目一直在那里还尝试使用删除它们

yarn remove dependency-name

It was removed from the package.json but not from the yarn.lock.它已从 package.json 中删除,但未从 yarn.lock 中删除。

I'm afraid that when i run the yarn install in a new environment it tries to pull the old dependencies found in yarn.lock and i've read that it's not recommended to edit yarn.lock manually.恐怕当我在新环境中运行 yarn install 时,它会尝试拉出在 yarn.lock 中找到的旧依赖项,并且我读到不建议手动编辑 yarn.lock。

How can i get rid of that old dependency entries that remain in yarn.lock without editing it manually?如何在不手动编辑的情况下摆脱保留在 yarn.lock 中的旧依赖项?

您可以尝试使用yarn-deduplicate工具清理您的yarn.lock文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM