提问者:小点点

node_modules/猫鼬/node_modules/mongoDB/mongoDB. ts34.d.ts:3288:5-错误TS1005:'?'预期


我试图在服务器中构建代码,但当我试图构建它时,显示以下错误node_modules/mongoose/node_modules/mongob/mongob. ts34.d.ts:3288:5-错误TS1005:'?'预期。node_modules/mongoose/node_modules/mongob/mongob.ts34.d.ts:4517:311-错误TS1005:';'预期。

包. 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"
        ],
      }


共1个答案

匿名用户

将我的打字稿更新到最新版本(=4.6.2)在这里对我有用。你应该试一试。检查你是否因为某种原因安装了旧的ts版本(包锁上的^应该足够了,但你永远不知道)。