问题描述
这是我们的应用启动时的样子:
This is what our app looks like when starting:
=> Started proxy.
=> Started MongoDB.
>>>>> IN ON_TEST
meteor-collection-management: updating npm dependencies -- mongodb...
=> Errors prevented startup:
While building package `meteor-collection-management`:
error: Can't install npm dependencies. Are you connected to the internet?
=> Your application has errors. Waiting for file change.
啊.在meteor-collection-management/package.js(我们自己的包)中,有这个:
Argh. In meteor-collection-management/package.js (our own package), there is this:
Package.on_test(function(api) {
console.log(">>>>> IN ON_TEST");
Npm.depends({
mongodb: "1.4.1"
});
api.use(['meteor-collection-management', 'tinytest', 'test-helpers']);
api.add_files('tests/dbobject-test.js', ['client', 'server']);
api.add_files('tests/enums-test.js', ['client', 'server']);
});
当我移除 Npm 位时,我现在可以在不尝试连接到网络的情况下工作.但这是一个完整的黑客.
When I removed the Npm bit, I could now work without it trying to connect to the network. But this is a complete hack.
mongodb 包已尽我所能下载;我们已经很久没有更改版本号了;如果我确实有互联网连接,该应用会成功启动.
The mongodb package is downloaded as best as I can tell; We haven't changed the version number in ages; and if I do have internet connection the app does start up successfully.
即使您不知道答案,也有任何关于如何调试的想法吗?
Any thoughts on how to debug this even if you don't know the answer?
推荐答案
您的应用必须不断重新下载 Npm 模块的原因是您可能有多个具有不同 Meteor 版本的应用.当您使用不同版本的 Meteor 运行不同的应用程序(甚至相同的应用程序)时,它会清除构建缓存并强制 Npm 模块重建.
The reason your app must keep re-downloading the Npm modules is you may have multiple apps with different Meteor versions. When you run a different app (or even the same app) with a different version of Meteor, it clears out the build cache and forces the Npm modules to rebuild.
至少这是重建 Npm 模块的主要原因.如果您有多个应用,请确保所有应用都使用最新版本(也不是来自 devel 的),否则它会一直这样做.
At least that's the main reason Npm modules are rebuilt. If you have multiple apps, ensure all use the latest version (also not the one from devel) or else it will keep doing this.
其他原因可能是它没有第一次安装,但在这种情况下它会抛出错误.
Other reasons may be it doesn't install the first time, but in this case it throws errors.
这篇关于为什么 Meteor-Npm 一直试图从互联网上获取包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!