Errors while running npm run start

When I run

npm run start

I get the following errors in my console:

cheun@pc-dd MINGW64 /d/_Back-end/mflix-project
$ npm run start

server@1.0.0 start D:_Back-end\mflix-project
nodemon -L ./index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node ./index.js
Browserslist: caniuse-lite is outdated. Please run next command npm update
(node:23668) Warning: Accessing non-existent property ‘count’ of module
exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:23668) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:23668) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:23668) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
MongoParseError: Invalid connection string
at parseConnectionString (D:_Back-end\mflix-project\node_modules\mongodb\lib\core\uri_parser.js:507:21)
at connect (D:_Back-end\mflix-project\node_modules\mongodb\lib\operations\connect.js:266:3)
at ConnectOperation.execute (D:_Back-end\mflix-project\node_modules\mongodb\lib\operations\connect.js:191:5)
at D:_Back-end\mflix-project\node_modules\mongodb\lib\operations\execute_operation.js:109:26
at new Promise ()
at executeOperation (D:_Back-end\mflix-project\node_modules\mongodb\lib\operations\execute_operation.js:102:10)
at MongoClient.connect (D:_Back-end\mflix-project\node_modules\mongodb\lib\mongo_client.js:216:10)
at Function.MongoClient.connect (D:_Back-end\mflix-project\node_modules\mongodb\lib\mongo_client.js:379:22)
at Object.connect (D:_Back-end\mflix-project\src/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1085:30)
[nodemon] app crashed - waiting for file changes before starting…

my .env file

# Ticket: Connection
# Rename this file to .env after filling in your MFLIX_DB_URI and your SECRET_KEY
# Do not surround the URI with quotes
SECRET_KEY=super_secret_key_you_should_change
MFLIX_DB_URI=mongodb:+srv//m220student:m220password@cluster0.ltxih.mongodb.net/sample_mflix?retryWrites=true&w=majority
MFLIX_NS=sample_mflix
PORT=5000

I tried deleting my nodes_modules and redo npm install.
My unit test is failing : npm test -t db-connection

But when i try http://localhost:5000/status and click connection i get the validation code…

Thanks in advance for ur help people

The above means you have an error in your connection string.

Your string, from the configuration file is:

It should be mongodb+srv:// rather than mongodb:+srv//

1 Like

Thanks again Steeve ! :sweat_smile: :grin: