Chapter0, ticket Connection. Cannot find module '@babel/register'

Hi,
I followed the instruction to setup the MFlix application, : (1) download and unzip “mflix-js.zip” (2) npm install, and ignore “node-gyp rebuild” errors, (3) npm start, and below errors. I’ve tried to solve by re-install or upgrade higher babel version and finally failed.

jonathanliudeMacBook-Pro:mflix-js jonathanliu$ npm start

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

[nodemon] 1.11.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node ./index.js
internal/modules/cjs/loader.js:883
throw err;
^

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

  • /Users/jonathanliu/graphQL/mflix-js/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (/Users/jonathanliu/graphQL/mflix-js/index.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions…js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘/Users/jonathanliu/graphQL/mflix-js/index.js’ ]
    }
    [nodemon] app crashed - waiting for file changes before starting…

I am also having this problem.

Did you get it solved? I am also having the same issue now

even i’m facing same problem!

is this issue solved?

Hey folks @Ninad_Sonawane, @CoderMan_N_A, @Omar_Ahmed & @Jonathan_69556 welcome to the community.
I am not sure what’s the actual cause behind this error. Maybe the packages are out of sync. Can you please try deleting the package-lock.json file and node_modules folder in the root directory of the project and re-install all the dependencies by issuing npm install command?

I hope it will fix the issue.

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

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Hey mate! Thanks for reaching out. I’m afraid to say that deleting package-lock.json file and re-installing give the error stated below:

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: server@1.0.0
npm ERR! Found: babel-eslint@9.0.0
npm ERR! node_modules/babel-eslint
npm ERR! babel-eslint@"^9.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer babel-eslint@"^7.2.3" from eslint-config-react-app@2.1.0
npm ERR! node_modules/eslint-config-react-app
npm ERR! eslint-config-react-app@"^2.1.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\User\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2021-07-15T16_16_00_751Z-debug.log

Hi @Ninad_Sonawane1, did you also delete the node_modules folder?
If not, please delete both of them: package-lock.json file & node_modules folder, and then install using the npm install.
If that still doesn’t work try again with

npm install --legacy-peer-deps

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

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Thank you!! :+1:
That solved the problem for me.

Why not just update the source files???

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

[nodemon] 1.19.4
[nodemon] to restart at any time, enter rs
[nodemon] watching dir(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node ./index.js
MongoParseError: URI malformed, cannot be parsed
at parseConnectionString (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\mongodb\lib\core\uri_parser.js:570:21)
at connect (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\mongodb\lib\operations\connect.js:282:3)
at E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\mongodb\lib\mongo_client.js:260:5
at maybePromise (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\mongodb\lib\utils.js:692:3)
at MongoClient.connect (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\mongodb\lib\mongo_client.js:256:10)
at Function.connect (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\mongodb\lib\mongo_client.js:401:22)
at Object. (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\src/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Module._compile (E:\Google Drive\WebDevs\MongoDB University Course\mflix-js\node_modules\pirates\lib\index.js:99:24)
at Module._extensions…js (internal/modules/cjs/loader.js:1101:10)
[nodemon] app crashed - waiting for file changes before starting…

Thank you! Deleting package-lock.json and running <npm install --legacy-peer-deps> solved my issue

1 Like