aldeed:collection2 无法使用 iron cli

aldeed:collection2 not working with iron cli

我是 meteor iron 的新手,我正在尝试安装 aldeed collection2,但该应用程序正在崩溃

W20190215-12:44:48.023(2)? (STDERR) WARNING: npm peer requirements (for aldeed:collection2) not installed:
W20190215-12:44:48.024(2)? (STDERR)  - simpl-schema@>=0.0.0 not installed.

我已经尝试安装 simple-schema 但没有任何效果。

meteor npm install simpl-schema --save

我也删除并重新安装了 collection2,但我仍然遇到同样的错误。我缺少什么?

我试图用一个新创建的 repo 重现错误,它包含你列出的依赖项,但我这边一切正常。

但是,我发现 aldeed:collection2-core 现在有点过时并被合并回 aldeed:collection2,您可以在 project repository on GitHub:

中阅读

MPORTANT: This package has been merged back into aldeed:collection2 as version 3.0.0 of that package. Refer to https://github.com/aldeed/meteor-collection2/blob/master/CHANGELOG.md#300

Create issues and PRs in the other repo going forward: https://github.com/aldeed/meteor-collection2/issues

Issues remain enabled on this repo for reference to existing issues only.

因此,最好的第一步是删除已弃用的软件包并安装更新的软件包:

meteor remove aldeed:collection2-core
meteor add aldeed:collection2

如果您想从一个新的干净项目开始,您可以在此处重现这些步骤以到达 运行 起点:

meteor create someprojectname
cd someprojectname
meteor add iron:router twbs:bootstrap aldeed:autoform aldeed:collection2
meteor npm install --save iron simpl-schema
meteor

项目将无错误地启动。从这里开始,您可以开始包括您以前的代码,看看错误是否会再次出现(这很可能是您代码中的一个问题)。

关于 twbs:bootstrap 的重要说明:

twbs:bootstrap 正在使用 old version (3.3.6) which is considered to contain several security vulnerabilities (read here and here).

如果你想使用最新的Bootstrap,你可能更愿意像这样使用 npm 安装bootstrap:

meteor remove twbs:bootstrap
meteor npm install --save bootstrap@latest jquery@latest popper.js@latest

你在这里也需要 jquery 因为 Meteor 不包含所需的版本并且 popper.js 处理 Popover,Modal 等

要将其包含在您的代码中,您需要将这些行添加到您的客户端代码中:

import 'bootstrap'
import popper from 'popper.js'
global.Popper = popper

要将 Bootstrap 4 与 AutoForm 一起使用,您可以安装 imajus:autoform-bootstrap4 (repo) 并将以下内容添加到您的客户端代码中:

AutoForm.setDefaultTemplate('bootstrap4')