App is not starting. I was just commencing the project, it showed errors

server@1.0.0 start
nodemon -L ./index.js

[nodemon] 2.0.16
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node ./index.js
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module ‘@babel/register’
Require stack:

  • C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js’ ]
    }
    [nodemon] app crashed - waiting for file changes before starting…
    Terminate batch job (Y/N)? y
    PS C:\Users\Saurabh Thakur\Downloads\mflix-js> npm test -t .\index.js

server@1.0.0 test
jest --passWithNoTests “.\index.js”

No tests found, exiting with code 0
PS C:\Users\Saurabh Thakur\Downloads\mflix-js> npm start

server@1.0.0 start
nodemon -L ./index.js

[nodemon] 2.0.16
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node ./index.js
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module ‘@babel/register’
Require stack:

  • C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js’ ]
    }
    [nodemon] app crashed - waiting for file changes before starting…
    Terminate batch job (Y/N)? y
    PS C:\Users\Saurabh Thakur\Downloads\mflix-js> node .\index.js
    node:internal/modules/cjs/loader:936
    throw err;
    ^

Error: Cannot find module ‘@babel/register’
Require stack:

  • C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js’ ]
    }

Hi @ToP_10, welcome to the community.
Can you please delete the:

  • package-lock.json file
  • node_modules folder

After that, run the install command:

npm install

And then, run the development server with the following command:

npm start

And hopefully, it will fix the issue.

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

Still showing this error, i have surfed alot about this error. Cant find any solution.
ERROR :-

server@1.0.0 start
nodemon -L ./index.js

[nodemon] 2.0.16
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node ./index.js
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module ‘@babel/register’
Require stack:

  • C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘C:\Users\Saurabh Thakur\Downloads\mflix-js\index.js’ ]
    }
    [nodemon] app crashed - waiting for file changes before starting…

Please help me. Its just the beginning and this project isnt running yet

Hi @ToP_10,
Please follow the steps mentioned in my previous post, but this time instead of running npm install run the following command:

npm install --legacy-peer-deps

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

2 Likes

either M220JS course instructions should include this command or the code base should be updated latest.

solved this issue earlier, now stuck in ticket projection assignment. don’t know what is happening wrong. Just a simple command and still showing errors.

it would be better if you give the error you get. but before that make sure it is not related to your modification. undo changes you made and see if the app works. you are required to match by countries given and project by title and nothing else should be changed.

1 Like

cursor = await movies.find({countries : { $in : countries}},{title:1});

this query isn’t working for multiple countries according to test file. Can you check this?

Projection
√ Can perform a country search for one country (285ms)
× Can perform a country search for three countries (1731ms)
This is the result of tests done.

your match and projection are correct for the mongo shell. the difference comes from mongodb driver for javascript.

check back to the previous lecture video, you will see a little difference in your query for projection.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.