Ticket : Migration launching node.js

Hi, can’t start the module required in the task. Here is what is going on:

C:\Users\Dzheb\mflix-js>node movie-last-updated-migration.js
internal/modules/cjs/loader.js:883
throw err;
^

Error: Cannot find module ‘C:\Users\Dzheb\mflix-js\movie-last-updated-migration.js’
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m’MODULE_NOT_FOUND’←[39m,
requireStack:
}

Do you have anyh ideas how to fix the problem?
Thanks
Boris

I seems that you are (in the terminal) in a different directory than the “movie-last-updated-migration.js” file.
Try “node src/migrations/movie-last-updated-migration.js” instead.
Another option is to navigate to the src/migrations folder first (within the terminal) and then execute “node movie-last-updated-migration.js”

That’s right. But what about instruction in Ticket: Migration:
Apr '20

Hi Everyone,

I hope everyone is safe and enjoying the courses! :slight_smile: During this Ticket Migration, if you got any error or not able to understand why it is not working, please verify the following points:

  1. You need to run the migration script from the main directory mflix-js . Otherwise, the config parameters like cluster uri and database name won’t be able to map.
  2. Also, verify the data type in the dataset of lastupdated field. It should be still string . Sometimes, when trying to make the script work, we mistakenly update the dataset with wrong data type, so it will prevent running the script further. as we are adding predicate with type: string in the query.
  3. Always check the error message carefully, after running the script, take a screenshot for sharing it in the forums or debugging it.

If you are still facing any issue, please feel free to create a new topic. :slight_smile:

Kanika
Anyway I tried to do it by way you’ve suggested. The response was:
(node:9920) Warning: Accessing non-existent property ‘count’ of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:9920) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:9920) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:9920) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
Error during migration, MongoParseError: URI malformed, cannot be parsed

As far as I can understand there is a problem with dependencies.

Boris