seppevs / migrate-mongo

A database migration tool for MongoDB in Node
MIT License
933 stars 168 forks source link

[BUG] Upgrade to v10.0.0 and cannot check migrate mongo version #435

Open coroo opened 1 year ago

coroo commented 1 year ago

Describe the bug I just update the v10.0.0 and got an error when checking version.

To Reproduce Steps to reproduce the behavior:

  1. Update to version 10.0.0
  2. run this script:
    migrate-mongo --version
  3. It will return the error:
    
    internal/modules/cjs/loader.js:892
    throw err;
    ^

Error: Cannot find module 'mongodb' Require stack:

Expected behavior Return the version of migrate-mongo, e.g. 9.0.0

Juuldamen commented 1 year ago

Same error when I run migrate-mongo up with v10 globally installed in a Docker container with image node:14-alpine. The repository has mongoose@5.12.12 installed which also requires mongodb@3.6.8, defined in the package-lock.json file. I can see it locally for the repository in node_modules/mongodb.

EDIT: Seems that v10 (https://github.com/seppevs/migrate-mongo/commit/e4d944680db7222482ce55340eaddf15c02c234d) of this package now requires MongoDB 4 or 5 as a peer dependency. With Node 14 peer dependencies aren't automatically installed so it so it cannot find a mongodb installation which matches this condition since I'm still using mongodb@3.6.8.