Can't configure shards

Hi, so I need to configure shards, but unfortunately I am getting this error. Can anyone help me on this to understand why it doesn’t work?

safa@Safa-MacBook-Pro ~ % mongosh --host localhost --port 27020
Current Mongosh Log ID:	664b71c0a326e64014084107
Connecting to:		mongodb://localhost:27020/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.5
Using MongoDB:		7.0.8
Using Mongosh:		2.2.5
mongosh 2.2.6 is available for download:

For mongosh info see:

   The server generated these startup warnings when booting
   2024-05-19T13:08:54.095+02:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2024-05-19T13:08:54.095+02:00: This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip <address> to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip to disable this warning

[direct: mongos] test> sh.addShard("rsShard1/localhost:30002")
MongoServerError[FailedToSatisfyReadPreference]: Could not find host matching read preference { mode: "nearest" } for set configrs

Following are the commands I ran for the set up:

mkdir -p ~/data/rsconfigdb/rep1
mkdir -p ~/data/rsShard1/rep1
mkdir -p ~/data/rsShard2/rep1
mkdir -p ~/data/rsShard3/rep1

mongod --configsvr --replSet "configrs" --dbpath c:/data/rsconfigdb/rep1 --port 31001

mongosh --host localhost --port 31001
rs.initiate( { _id: "configrs", configsvr: true, members: [ { _id: 0, host: "localhost:31001" } ] } )

mongod --shardsvr --replSet "rsShard1" --dbpath c:/data/rsShard1/rep1 --port 30002
mongosh --host localhost --port 30002
rs.initiate({ _id: "rsShard1" , members: [ { _id: 0, host: "localhost:30002" } ] } )

mongod --shardsvr --replSet "rsShard2" --dbpath c:/data/rsShard2/rep1 --port 30003
mongosh --host localhost --port 30003
rs.initiate({ _id: "rsShard2", members: [ { _id: 0, host: "localhost:30003" } ] } )

mongod --shardsvr --replSet "rsShard3" --dbpath c:/data/rsShard3/rep1 --port 30004
mongosh --host localhost --port 30004
rs.initiate({ _id: "rsShard3", members: [ { _id: 0, host: "localhost:30004" } ] } )

mongos --configdb configrs/localhost:31001 --port 27020

mongosh --host localhost --port 27020

sh.addShard("rsShard1/localhost:30002") # getting the error for this command…