Meteor - errors after adding autoform package

2019-05-26 10:49发布

问题:

I am trying to add the autoform package to my meteor project. After running "meteor add aldeed:autoform" and adding the package - I am encountering the following errors: Cannot find module 'mongo-object', Cannot read property 'AutoForm' of undefined, Uncaught ReferenceError: meteorInstall is not defined

I didn't even try to use the package. Just adding the package caused the errors. I am using Meteor 1.4.4.1

Any idea why this happens ? I followed the instruction in the autoform github repo.

回答1:

The installation for autoform 6 says the following:

$ meteor add aldeed:autoform
$ npm i --save simpl-schema

Then you need (in v. >=6.0.0) to enable the use of autoform entries in SimpleSchema definitions. This is just required once, e.g. in your startup scripts:

import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);

What is not 100% clear to most people, switching to af6

  1. you need to remove the old aldeed:simple-schema package from the meteor packages
  2. you need to switch from the deprecated collection2 to collection2-core
  3. you need to be aware of the change log, which indicates deprecated method and method name changes.

If you concern all of these changes it should run really fine again.

Update March 2018: collection2-core is now merged back to aldeed:collection2 so use the latest version of this package.