简体   繁体   English

全局安装Meteor包

[英]Installing Meteor packages globally

Is there a way to install meteor packages globally? 有没有办法在全球安装流星包?

So, having the once globally installed packages installable without internet connection for projects created later, avoid repetitive downloading, and other benefits one may imagine. 因此,在以后创建的项目中安装一次全局安装的软件包而无需互联网连接,避免重复下载,以及人们可能想到的其他好处。

Like in Node.js, using npm command (of Node Package Manager) with -g flag, npm install -g , doing so npm installs node packages into a global directory and when wanted to be loaded from javascript programs, loading from there if available, as well as looking in and loading packages from project's node modules folder. 就像在Node.js中一样,使用npm命令(Node Package Manager)和-g标志, npm install -g ,这样做npm将节点包安装到一个全局目录中,当想从javascript程序加载时,从那里加载如果可用,以及从项目的节点模块文件夹中查找和加载包。

Meteor already downloads packages into a global repository that all your local apps benefit off of. Meteor已经将软件包下载到一个全局存储库中,所有本地应用程序都可以从中受益。

So if you meteor add iron:router@1.0.7 it is downloaded and added to your project. 所以,如果你meteor add iron:router@1.0.7它被下载并添加到你的项目中。 Next time another project requires the same version, it is used off that same spot. 下次另一个项目需要相同的版本时,它会在相同的位置使用。

Also, there is a PACKAGES_DIR environment variable, when set, allows you to keep your own local packages centrally, so that you can share them among projects. 此外,还有一个PACKAGES_DIR环境变量,当设置时,允许您集中保留自己的本地包,以便您可以在项目之间共享它们。 In fact, you can keep that on a network drive (NFS) which your whole team can mount and consume centrally. 实际上,您可以将其保存在整个团队可以集中安装和使用的网络驱动器(NFS)上。

Yet, there is an inherent problem. 然而,存在一个固有的问题。 Meteor's version resolver looks up for updates unless you pin down your package dependency versions so that is exactly why meteor seems to be so desperate to be connected. Meteor的版本解析器会查找更新, 除非您确定了包依赖版本 ,这正是流星似乎非常渴望连接的原因。

Even if you pin your dependencies, the packages you depend on may not have (which apparently is the case for most packages) so Meteor keeps looking for updates to the whole package tree and downloads those that it deems satisfying the version constraint resolver. 即使固定了依赖项,您依赖的软件包也可能没有(大多数软件包都是如此),因此Meteor不断寻找整个软件包树的更新,并下载它认为满足版本约束解析程序的软件包。

The good news is, they are constantly improving their tooling, requiring lower number of lookups, faster builds, better search etc. 好消息是,他们不断改进他们的工具,需要更少的查找次数,更快的构建,更好的搜索等。

All in all, in essence, there is not much you can do unless Meteor provides some way of hosting an entire mirror of its package repository for you to consume offline. 总而言之,除非Meteor提供某种方式来托管其软件包存储库的整个镜像供您脱机使用,否则您无能为力。 And I guess it is very unlikely to happen. 我想这不太可能发生。

Meteor is a tool for the connected world and it does assume your connectivity. Meteor是连接世界的工具,它确实假设您的连接。 Heck, the whole journey begins with a curl https://install.meteor.com/ | sh 哎呀,整个旅程从curl https://install.meteor.com/ | sh开始curl https://install.meteor.com/ | sh curl https://install.meteor.com/ | sh

And yes, it would be great if we could hack away on a remote beach, or the 12 hour flight to that beach. 是的,如果我们可以在远程海滩或12小时飞往该海滩的地方进行攻击,那将会很棒。

Until then, happy coding online ;) 在那之前,快乐编码在线;)

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

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