meteoriron-router

aldeed:collection2 not working with iron cli


I am new to meteor iron and I am trying to install aldeed collection2 but the app is crushing

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.

I have tried to install simple-schema but nothing is working.

meteor npm install simpl-schema --save

I have also removed and reinstalled collection2 but I still get the same error. What is it that I am missing?


Solution

  • I tried to reproduce the error with a new created repo, that contains the dependencies you have listed but everything runs fine on my side.

    However, I found, thataldeed:collection2-core is now somewhat deprecated and being merged back into aldeed:collection2 as you can read in the 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.

    So a good first step would be to remove the deprecated package and install the updated one:

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

    If you want to start from a new clean project you can reproduce these steps to get to a running starting point here:

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

    The project will start without errors. From here you can start including your former code and see if the error will come back (which is then likely to be an issue inside your code) or not.

    Important note on twbs:bootstrap:

    The package twbs:bootstrap is using an old version (3.3.6) which is considered to contain several security vulnerabilities (read here and here).

    If you want to use the latest Bootstrap you may rather install bootstrap using npm like so:

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

    You need jquery here, too because Meteor does not contain the required version and popper.js handles the Popover, Modal etc.

    To include it in your code you need to add these lines to your client code:

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

    To use Bootstrap 4 with AutoForm you can install imajus:autoform-bootstrap4 (repo) and add the following to your client code:

    AutoForm.setDefaultTemplate('bootstrap4')