Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The migrate-mongo create command stopped working in V9.0.0 #411

Open
mary-deca opened this issue Apr 12, 2022 · 5 comments
Open

The migrate-mongo create command stopped working in V9.0.0 #411

mary-deca opened this issue Apr 12, 2022 · 5 comments

Comments

@mary-deca
Copy link

Describe the bug
I upgraded to version 9.0.0. The command for creating a script doesn't work for me on the new version 9.0.0 but works fine when I went back to version 8.2.3

To Reproduce

  1. I uninstalled and installed migrate-mongo to get the latest version
  2. I tried to create a new script using migrate-mongo create command but I got the error message shown below
> db-migration-tool@1.0.0 migrate:create
> migrate-mongo create "name-of-my-script"

ERROR: ENOENT: no such file or directory, lstat '/Users/mary_e/Documents/db-migration-tool/node_modules/migrate-mongo/samples/undefined/migration.js' 
Error: ENOENT: no such file or directory, lstat '/Users/mary_e/Documents/db-migration-tool/node_modules/migrate-mongo/samples/undefined/migration.js'

Expected behavior
I expected that a new file be created in the migrations folder as on the older version.

Additional context
Checking the file path in the error message above, I think that a folder is expected to not be undefined. The expected file seems to be the one here https://github.com/seppevs/migrate-mongo/blob/master/samples/commonjs/migration.js

@hardikdiyora
Copy link

@mary-deca
Solution: you need to add below line in your migrate-mongo-config.js inside config object
moduleSystem: 'commonjs' or moduleSystem: 'esm' depending on module system you are using.

@GDnsk
Copy link

GDnsk commented May 25, 2022

It worked. Thank you!!!

@samkaizenly
Copy link

I get the same error s OP even after confirming that the migrate-mongo-config.js has the correct modulesystem: 'esm' for my code... version is 9.0.0 for me as well

@bradyjibanez
Copy link

Ensure that moduleSystem is the key name, not modulesystem

@nocodehummel
Copy link

Could workaround modulesystem: 'esm' be updated in the README example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants