1 year ago

#377408

test-img

Youmna Salloum

how to solve mongoParseError in nodeModule?

this is output after run yarn start having this is the error:

`yarn run v1.22.17
warning ../../../package.json: No license field
$ ts-node index.ts
MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
    at new ConnectionString (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongodb-connection-string-url/src/index.ts:133:13)
    at parseOptions (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/node_modules/mongodb/src/connection_string.ts:253:15)
    at new MongoClient (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/node_modules/mongodb/src/mongo_client.ts:337:34)
    at /Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/connection.js:783:16
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/connection.js:780:19)
    at Mongoose.createConnection (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/index.js:285:10)
    at Object.<anonymous> (/Users/youmnasalloum/Desktop/ts/user/db/index.ts:9:28)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Module.m._compile (/Users/youmnasalloum/Desktop/ts/user/node_modules/ts-node/src/index.ts:1455:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [start] Error 1`

this is package.json:

{   "name": "user",   "version": "1.0.0",   "main": "index.ts",   "repository": "https://github.com/ArtistCrowdfundExchange/user",   "author": "Oghogho Odemwingie",   "license": "MIT",   "devDependencies": {     "@types/bcrypt": "^3.0.0",     "@types/node": "^17.0.13",     "typescript": "4.5.5"   },   "scripts": {     "start": "ts-node index.ts",     "test": "echo no tests yet"   },   "dependencies": {     "@aws-sdk/client-s3": "^3.41.0",     "@grpc/grpc-js": "^1.3.7",     "amqp": "^0.2.7",     "aws4": "^1.11.0",     "bcrypt": "^5.0.0",     "cuid": "^2.1.8",     "encrypter": "^1.0.0",     "erax.db": "^3.3.1",     "jose": "3",     "mongodb": "^4.5.0",     "mongodb-uri": "^0.9.7",     "mongoose": "6.1.8",     "nanoid": "^3.1.29",     "proto": "git+https://github.com/ArtistCrowdfundExchange/proto#playground",     "ts-node": "^10.4.0",     "winston": "^3.3.3",     "yael-autoencrypt": "^1.1.0"   } }

I tried to add packages mongo-Uri,mongo-connection-string-URI using yarn but still the same error when I do yarn start

mongodb

node-modules

package.json

yarn-v2

0 Answers

Your Answer

Accepted video resources