Meteor 应用程序在第二个终端中看不到本地包

Meteor app does not see local packages in second terminal

我有一个名为 packagetester 的应用程序,其中包含一个 /packages 目录,并且在 /packages 目录中有一个名为 lauffenp:notifications 的本地程序包。

这是来自 packagetester 的包文件。

meteor-base             # Packages every Meteor app needs to have
mobile-experience       # Packages for a great mobile UX
mongo                   # The database Meteor supports right now
blaze-html-templates    # Compile .html files into Meteor Blaze views
session                 # Client-side reactive dictionary for your app
jquery                  # Helpful client-side library
tracker                 # Meteor's client-side reactive programming  library

standard-minifiers      # JS/CSS minifiers run for production mode
es5-shim                # ECMAScript 5 compatibility for older browsers.
ecmascript              # Enable ECMAScript2015+ syntax in app code

autopublish             # Publish all data to the clients (for prototyping)
insecure                # Allow all DB writes from clients (for prototyping)

lauffenp:notifications

现在,如果我 运行 它在一个终端中使用 meteor,它工作正常,它找到它应该的包并执行它。

但是,如果我打开第二个终端并尝试做同样的事情,它找不到包:

=> Started MongoDB.                           
=> Errors prevented startup:                  

   While selecting package versions:
   error: unknown package in top-level dependencies: lauffenp:notifications

这是应用 运行在左侧终端上运行但在右侧终端上失败的屏幕截图。 screen capture of app running/not running in two terminal instances

如果我退出左侧终端,它不会 运行 并给我同样的错误。我必须 meteor removemeteor add 以某种方式 'reset' 包然后我可以 运行 它在一个终端上。

如何让 meteor 到 'persist' 本地包裹?

你在第二个终端上得到的错误似乎与丢失的包有关,但实际上这是因为你试图 运行 同一目录中同一应用程序的多个实例.

你不能那样做。

虽然一个实例试图将应用程序构建到 .meteor/local 目录中,但其他实例竞相清理和重建,其中一个实例失去了对依赖项的跟踪,因此出现误导性错误消息。

但是如果您在另一个终端上查看之前的警告,您会发现实际问题是多个实例。

  • 如果有其他东西在 3000 上监听,你必须 运行 meteor 在另一个端口上
  • 如果您想 运行 同一个应用程序的两个实例,您必须创建应用程序文件夹的另一个副本,运行 来自该复制文件夹的第二个实例并将其设置为侦听另一个端口