warCommander
warCommander

Reputation: 449

MongoDb can't create migration scripts

I am trying to create a migration script on an existing project with already initialized migrate-mongo. I'm using windows btw.

Here is my problem. When I try to create a script using this command migrate-mongo create blacklist_the_beatles I get this error.

ERROR: ENOENT: no such file or directory, lstat 'C:\Users\saadb\AppData\Roaming\npm\node_modules\migrate-mongo\samples\undefined\migration.js' Error: ENOENT: no such file or directory, lstat 'C:\Users\saadb\AppData\Roaming\npm\node_modules\migrate-mongo\samples\undefined\migration.js'

I am running the command from VS code terminal. Is this right or should I run it from somewhere else

Upvotes: 5

Views: 3486

Answers (3)

Just add moduleSystem property in your migrate-mongo-config.js

It can be esm or commonjs, depends on which one you using. More details here - https://github.com/seppevs/migrate-mongo/blob/49e6de971bc9581ce3a2321da2180a7877aff3a6/samples/esm/migrate-mongo-config.js

Upvotes: 5

maveriq
maveriq

Reputation: 516

Seems very weird, buy I was able to solve the issue by manually creating "undefined" folder in the prompted path, and I also put there all files from commonjs folder.

Upvotes: 0

yitzhak
yitzhak

Reputation: 19

Running the following code solved the problem:

npx migrate-mongo create blacklist_the_beatles

Upvotes: 0

Related Questions