Search code examples
node.jsvuejs3

Unable to execute `npm run build` for Vue3 project due to an error


I have build a project in Vue3 and now I'm trying to npm run build the project (node version 20.17.0). I'm getting following error (in node_modules/@types/node/stream/web.d.ts:469:56 - '?' expected):

ERROR Failed to compile with 1 error 12:02:09 PM

error in node_modules/@types/node/stream/web.d.ts:469:56

TS1005: '?' expected. 467 | // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts 468 | ReportingObserver: any;

469 | DecompressionStream: infer T extends object; | ^ 470 | } ? T 471 | // TS 4.8, 4.9, 5.0 472 | : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {

ERROR Error: Build failed with errors. Error: Build failed with errors.

Please advise.

The npm run serve runs just fine. Here the package.json file:

{
  "name": "[hidden]",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@aws-amplify/ui-vue": "^4.2.8",
    "@popperjs/core": "^2.11.8",
    "@vuepic/vue-datepicker": "^8.8.0",
    "@vueuse/core": "^10.11.0",
    "aws-amplify": "^6.3.6",
    "axios": "^1.7.2",
    "bootstrap": "^5.3.3",
    "chart.js": "^4.4.4",
    "core-js": "^3.8.3",
    "lodash": "^4.17.15",
    "pinia": "^2.1.7",
    "sortablejs": "^1.15.2",
    "vue": "^3.2.13",
    "vue-chartjs": "^5.3.1",
    "vue-class-component": "^8.0.0-0",
    "vue-i18n": "^9.13.1",
    "vue-router": "^4.0.3",
    "vue-select": "^4.0.0-beta.6",
    "vue-toastification": "^2.0.0-rc.5",
    "vuedraggable": "^4.1.0"
  },
  "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-router": "~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",
    "sass": "^1.32.7",
    "sass-loader": "^12.0.0",
    "typescript": "~4.5.5"
  }
}

It's a simple admin panel running on localhost:8080


Solution

  • After a migration towards Vite and Node v22, OP solved the issue.