7

i was trying to build the code in the server but when i m trying to build its showing the below error node_modules/mongoose/node_modules/mongodb/mongodb.ts34.d.ts:3288:5 - error TS1005: '?' expected. node_modules/mongoose/node_modules/mongodb/mongodb.ts34.d.ts:4517:311 - error TS1005: ';' expected.

enter image description here

package.json

    "dependencies": {
        "@types/lodash": "^4.14.119",
        "@types/mongodb": "^4.0.7",
        "@types/npm": "^2.0.29",
        "axios": "^0.24.0",
        "bcrypt": "^5.0.1",
        "bcryptjs": "^2.4.3",
        "class-validator": "^0.9.1",
        "compression": "^1.7.3",
        "connect-multiparty": "^2.2.0",
        "crypto": "^1.0.1",
        "crypto-js": "^4.1.1",
        "dotenv": "^6.2.0",
        "enum": "^2.5.0",
        "eslint-import-resolver-node": "^0.3.2",
        "express": "^4.16.4",
        "express-session": "^1.17.2",
        "fs": "0.0.1-security",
        "helmet": "^3.15.0",
        "in-app-purchase": "^1.11.4",
        "ip-to-location": "^1.0.1",
        "jm-ez-l10n": "^1.0.0",
        "jm-ez-mysql": "^2.3.0",
        "jsonwebtoken": "^8.4.0",
        "method-override": "^3.0.0",
        "moment": "^2.29.1",
        "moment-timezone": "^0.5.25",
        "mongoose": "^6.0.4",
        "morgan": "^1.9.1",
        "multer": "^1.4.3",
        "node-cron": "^3.0.0",
        "node-jsencrypt": "^1.0.0",
        "node-php-password": "^0.1.2",
        "node-uuid": "^1.4.8",
        "nodemon": "^2.0.12",
        "nvm": "^0.0.4",
        "oauth2orize": "^1.11.1",
        "otp-generator": "^2.0.1",
        "passport-http-bearer": "^1.0.1",
        "path": "^0.12.7",
        "q": "^1.5.1",
        "randomstring": "^1.2.1",
        "request": "^2.88.0",
        "request-ip": "^2.1.3",
        "ts-node-dev": "^1.0.0-pre.32",
        "uuidv4": "^6.2.12",
        "winston": "^3.1.0"
      },
      "devDependencies": {
        "@types/bcryptjs": "^2.4.2",
        "@types/body-parser": "^1.17.0",
        "@types/node": "^15.14.0",
        "@types/node-uuid": "0.0.28",
        "@types/q": "^1.5.2",
        "husky": "^1.3.1",
        "rimraf": "^2.6.3",
        "ts-node": "^8.0.3",
        "tslint": "^5.20.1",
        "typescript": "^3.4.1",
        "typescript-eslint-parser": "^21.0.2"
      }
    }

tsconfig.json

  

    {
        "compileOnSave": true,
        "compilerOptions": {
          "target": "es6",
          "module": "commonjs",
          "outDir": "./dist",
          "sourceMap": true,
          "skipLibCheck": true,
          "experimentalDecorators": true,
          "allowJs": true,
          "plugins": [
            { "name": "typescript-tslint-plugin" ,
              "alwaysShowRuleFailuresAsWarnings": false,
              "ignoreDefinitionFiles": true,
              "configFile": "../tslint.json",
              "suppressWhileTypeErrorsPresent": false}
          ]
        },
        "files": [
          "./node_modules/@types/node/index.d.ts"
        ],
        "include": [
          "src/**/*.ts"
        ],
        "exclude": [
          "node_modules"
        ],
      }

2
  • Have you found anything yet? Commented Mar 5, 2022 at 9:03
  • 1
    same issue with "typescript": "^4.6.3" and "@types/mongoose": "^5.11.97", Commented Apr 1, 2022 at 19:34

1 Answer 1

7

Updating my typescript to the latest version (=4.6.2) worked here for me. You should give it a try. Check if you're installing an older ts version for some reason (the ^ on your package-lock should suffice, but you never know).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.