Got this error when nmp start
:
npm start
> binary-server@0.1.0 start
> node app.js
(node:2330) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:2330) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
/Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/topologies/server.js:438
new MongoNetworkError(
^
MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1137:16) {
name: 'MongoNetworkError'
}]
at Pool.<anonymous> (/Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/topologies/server.js:438:11)
at Pool.emit (node:events:378:20)
at /Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/connection/pool.js:562:14
at /Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/connection/pool.js:995:11
at /Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/connection/connect.js:32:7
at callback (/Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/connection/connect.js:280:5)
at Socket.<anonymous> (/Users/maling/Desktop/MGSpecs/binary-sever/node_modules/mongodb/lib/core/connection/connect.js:310:7)
at Object.onceWrapper (node:events:485:26)
at Socket.emit (node:events:378:20)
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR! code 1
npm ERR! path /Users/maling/Desktop/MGSpecs/binary-sever
npm ERR! command failed
npm ERR! command sh -c node app.js
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/maling/.npm/_logs/2021-08-23T07_06_42_476Z-debug.log
Start mongod and specify the database path
sudo mongod --dbpath=/usr/local/data/db