NPM dependencies shared by dependencies

青春壹個敷衍的年華 提交于 2019-12-10 23:34:45

问题


On npm 3.3.12 (node 4.2.2), the following thing happen:

I run npm install in a project where one of the dependencies in my project is also a dependency of one of the other dependencies. For instance:

  • My project depend on PackageA and PackageB
  • PackageA also depend on PackageB
  • Both My project and PackageA depend on the same verison of PackageB

Then, I run npm update in my prroject. The NPM output lists:

PackageB@x.x.x node_modules/PackageB -> node_modules/PackageA/node_modules/PackageB

So then suddenly PackageB is not in node_modules of my project (only in node_modules under PackageA) and require("PackageB") in the files of the project fails.

What is causing this, and how can I best avoid the issue?


回答1:


It was a bug, fixed in NPM 3.4.1:

https://github.com/npm/npm/issues/10446



来源:https://stackoverflow.com/questions/33750940/npm-dependencies-shared-by-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!