每当我尝试使用npm安装节点包时,它都会运行以下命令:
npm http 304 http://registry.npmjs.org/cryptiles
npm http 200 http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.10.tgz
npm http 200 http://registry.npmjs.org/domhandler/-/domhandler-2.2.0.tgz
npm http 304 http://registry.npmjs.org/delayed-stream/0.0.5
npm http 200 http://registry.npmjs.org/esprima
npm http GET http://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz
npm http 200 http://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz
npm http 200 http://registry.npmjs.org/punycode
npm http GET http://registry.npmjs.org/punycode/-/punycode-1.2.3.tgz
npm http GET http://registry.npmjs.org/core-util-is
npm http GET http://registry.npmjs.org/debuglog/0.0.2
npm http 200 http://registry.npmjs.org/punycode/-/punycode-1.2.3.tgz
npm http 200 http://registry.npmjs.org/core-util-is
npm http GET http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm http 200 http://registry.npmjs.org/debuglog/0.0.2
npm http GET http://registry.npmjs.org/debuglog/-/debuglog-0.0.2.tgz
npm http 200 http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm http 200 http://registry.npmjs.org/debuglog/-/debuglog-0.0.2.tgz
npm http 200 http://registry.npmjs.org/argparse
npm http GET http://registry.npmjs.org/argparse/-/argparse-0.1.15.tgz
npm http 200 http://registry.npmjs.org/argparse/-/argparse-0.1.15.tgz
npm http GET http://registry.npmjs.org/underscore
npm http GET http://registry.npmjs.org/underscore.string
npm http 304 http://registry.npmjs.org/underscore
...
我知道这些是包的依赖项,但是例如现在安装了cryptiles
包,下次当我想安装另一个依赖于cryptiles
的包时,npm再次运行此命令:
npm http 304 http://registry.npmjs.org/cryptiles
有什么建议吗?
答案 0 :(得分:0)
npm按设计方式工作。
因为npm
在本地安装软件包,而不是全局安装软件包,所以最终会有多个版本的cryptiles
软件包,因为您的应用程序依赖于0.2.x而另一个软件包依赖于0.1.x
您可以阅读由npm
的创建者撰写的this blog post的第一项(同时处理同一事物的多个版本)以更好地理解这一点