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:UserssaadbAppDataRoamingnpmnode_modulesmigrate-mongosamplesundefinedmigration.js' Error: ENOENT: no such file or directory, lstat 'C:UserssaadbAppDataRoamingnpmnode_modulesmigrate-mongosamplesundefinedmigration.js'
I am running the command from VS code terminal. Is this right or should I run it from somewhere else
3
Answers
Running the following code solved the problem:
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.
Just add
moduleSystem
property in yourmigrate-mongo-config.js
It can be
esm
orcommonjs
, depends on which one you using. More details here – https://github.com/seppevs/migrate-mongo/blob/49e6de971bc9581ce3a2321da2180a7877aff3a6/samples/esm/migrate-mongo-config.js