在heroku中上载项目时出错:节点模块/mongoose/类型/查询

eagi6jfj  于 2022-11-24  发布在  Go
关注(0)|答案(1)|浏览(136)

我用MEVN堆栈做了一个任务列表,一切都很好,直到我试图上传到Heroku。我收到这个错误,虽然我试图更新“typescript”,mongoose,等等。我不知道该怎么做知道。这里是我的文件。在我的本地主机一切正常,早些时候我收到了一个错误,“摩根”,“cors”和“mongoose”模块无法找到,但是只要交换我的devDep和我的依赖项就可以了。
就像我说的,我试着更新我的 typescript , Mongoose ,看起来这不是问题所在。

"dependencies": {
"@types/mongoose": "^5.11.97",
"axios": "^0.27.2",
"bootswatch": "^5.2.1",
"core-js": "^3.8.3",
"cors": "^2.8.5",
"mongoose": "^6.6.4",
"morgan": "^1.10.0",
"vue": "^3.2.13",
"vue-router": "^4.0.13"

},
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.4.0",
    "@typescript-eslint/parser": "^5.4.0",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-typescript": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "@vue/eslint-config-typescript": "^9.1.0",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3",
    "typescript": "~4.5.5"
  },
  "engines": {
    "node": "16.x",
    "npm": "8.x"
  }

配置

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "useDefineForClassFields": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

错误:

> server@1.0.0 build
       > tsc
       
       ../node_modules/mongoose/types/query.d.ts(619,34): error TS1144: '{' or ';' expected.
       ../node_modules/mongoose/types/query.d.ts(619,45): error TS1005: '>' expected.
       ../node_modules/mongoose/types/query.d.ts(619,77): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(622,19): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(622,41): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(622,50): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(622,73): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(622,114): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(622,138): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(622,155): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(622,186): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(622,187): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(622,257): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(630,23): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(630,45): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(630,54): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(630,77): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(630,118): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(630,142): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(630,159): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(630,190): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(630,191): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(630,261): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(636,22): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(636,44): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(636,53): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(636,76): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(636,117): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(636,141): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(636,158): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(636,189): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(636,190): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(636,260): error TS1005: '(' expected.
       ../node_modules/mongoose/types/query.d.ts(642,10): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(642,35): error TS1005: ';' expected.
       ../node_modules/mongoose/types/query.d.ts(645,15): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(645,29): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(645,35): error TS1005: ';' expected.
       ../node_modules/mongoose/types/query.d.ts(646,14): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(646,23): error TS1005: ';' expected.
       ../node_modules/mongoose/types/query.d.ts(647,12): error TS1005: ';' expected.
       ../node_modules/mongoose/types/query.d.ts(650,16): error TS1109: Expression expected.
       ../node_modules/mongoose/types/query.d.ts(650,22): error TS1005: ';' expected.
       ../node_modules/mongoose/types/query.d.ts(657,16): error TS1005: ',' expected.
       ../node_modules/mongoose/types/query.d.ts(657,25): error TS1005: ';' expected.
       ../node_modules/mongoose/types/query.d.ts(659,1): error TS1128: Declaration or statement expected.
-----> Build failed
sbtkgmzw

sbtkgmzw1#

mongoose GitHub项目页面上有一个未解决的问题。请参见https://github.com/Automattic/mongoose/issues/12529
由于依赖性问题,我正在处理的项目无法更新为使用最新版本的TypeScript(问题页面中提到的解决方法之一)。我能够通过(稍微)降级Mongoose NPM的版本来解决它。

npm install mongoose@6.6.3

相关问题