简体   繁体   English

在npm安装之前,删除node_modules吗?

[英]Before npm install delete node_modules?

是否需要在执行“ npm install”之前删除node_modules以获得更可靠的安装,还是npm覆盖所有内容?

Npm definitely does not overwrite everything every time. Npm绝对不会每次都覆盖所有内容。 It runs through a fairly complicated process that I won't dive deep into here, but in general you should not need to delete node_modules every time. 它通过一个相当复杂的过程运行,在此我将不做深入探讨,但是通常您不必每次都删除node_modules npm exists to handle this situation and generally will only download newly added or updated packages. npm可以处理这种情况,通常只会下载新添加或更新的软件包。

I will occasionally find myself in the need to completely remove the node_modules directory in the event that I have been add/removing/updating a large number of packages. 在添加/删除/更新大量软件包的情况下,有时我会发现自己需要完全删除node_modules目录。 Sometimes packages can get cached. 有时可以缓存程序包。 But it's not a common occurrence and I usually only recommend it when you notice a package appears out of date. 但这并不常见,我通常仅在发现软件包过时时才建议这样做。

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

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