expressjs / serve-static

Serve static files
MIT License
1.38k stars 227 forks source link

Cannot use namespace 'HttpError' as a type #159

Open jeffysam6 opened 6 months ago

jeffysam6 commented 6 months ago

I keep getting this error on "npm run build" from this particular file node_modules/@types/serve-static/index.d.ts:98:67 - error TS2709: Cannot use namespace 'HttpError' as a type.

Node version : 18

The two libraries dependent on serve-static in my dependencies are firebase-functions and express

This is my package.json

{
  "name": "functions",
  "scripts": {
    "lint": "eslint \"src/**/*\"",
    "build": "tsc",
    "build:watch": "tsc --watch --preserveWatchOutput",
    "build:prod": "npm run build",
    "serve": "npm run build:watch | firebase emulators:start",
    "stop": "npx kill-port 9099 5001 8080 9000 5000 8085 7090 9199",
    "dev": "npm run build -- --watch | firebase emulators:start",
    "dev:data": "npm run build -- --watch | firebase emulators:start --inspect-functions --import ../db_may_14_2022",
    "serve:functions": "npm run build && firebase emulators:start --only functions",
    "functions:watch": "npm run build:watch && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "test": "jest",
    "deploy": "npm run build && firebase deploy --only functions",
    "logs": "firebase functions:log",
    "prettify": "prettier --write \"src/**/*.ts\"",
    "lint:eslint": "eslint --ignore-path .gitignore",
    "lint:eslint:fix": "eslint --ignore-path .gitignore --fix",
    "lint:staged": "lint-staged"
  },
  "lint-staged": {
    "*.ts": [
      "npm run lint:eslint:fix",
      "prettier --write",
      "git add --force"
    ],
    "*.js": [
      "npm run lint:eslint:fix",
      "prettier --write",
      "git add --force"
    ],
    "*.json": [
      "prettier --write",
      "git add --force"
    ]
  },
  "pre-commit": "lint:staged",
  "engines": {
    "node": "18"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@dqbd/tiktoken": "^1.0.7",
    "@faker-js/faker": "^7.6.0",
    "@firestore-simple/admin": "^7.0.5",
    "@google-cloud/bigquery": "^5.9.2",
    "@google-cloud/firestore": "^4.3.0",
    "@google-cloud/logging-winston": "^4.1.1",
    "@langchain/openai": "^0.0.11",
    "@sentry/node": "^7.35.0",
    "@sentry/tracing": "^7.35.0",
    "@types/cors": "^2.8.9",
    "@types/serve-static": "^1.15.5",
    "@types/stripe": "^8.0.417",
    "aws-sdk": "^2.841.0",
    "axios": "^0.21.4",
    "axios-retry": "^3.5.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.1",
    "cls-hooked": "^4.2.2",
    "cls-rtracer": "^2.6.0",
    "compromise": "^14.10.0",
    "cookie-parser": "^1.4.5",
    "cors": "^2.8.5",
    "csv-writer": "^1.6.0",
    "csvtojson": "^2.0.10",
    "exponential-backoff": "^3.1.1",
    "express": "^4.18.2",
    "faiss-node": "^0.2.2",
    "firebase-admin": "^9.5.0",
    "firebase-functions": "^3.24.1",
    "firebase-tools": "^10.2.0",
    "firestore-export-import": "^1.1.0",
    "googleapis": "^126.0.1",
    "html-pdf-node": "^1.0.8",
    "http-errors": "^2.0.0",
    "jwt-decode": "^3.1.2",
    "langchain": "^0.1.2",
    "langsmith": "^0.0.57",
    "moment": "^2.29.1",
    "morgan": "^1.10.0",
    "nodemailer": "^6.4.17",
    "openai": "^3.2.1",
    "pdf.js-extract": "^0.1.5",
    "pdfkit": "^0.13.0",
    "query-string": "^7.0.1",
    "raw-body": "^2.4.1",
    "simple-spellchecker": "^1.0.2",
    "slack-notify": "^2.0.6",
    "stripe": "^12.6.0",
    "tiktoken": "^1.0.10",
    "uuid": "^8.3.2",
    "winston": "^3.3.3"
  },
  "devDependencies": {
    "@babel/cli": "^7.22.5",
    "@babel/core": "^7.22.5",
    "@babel/node": "^7.22.5",
    "@babel/preset-env": "^7.22.5",
    "@faker-js/faker": "^7.6.0",
    "@types/aws-sdk": "^2.7.0",
    "@types/babel__core": "7.1.18",
    "@types/babel__traverse": "7.14.2",
    "@types/cookie-parser": "^1.4.2",
    "@types/express": "^4.17.21",
    "@types/morgan": "^1.9.2",
    "@types/node": "^14.14.25",
    "@types/nodemailer": "^6.4.0",
    "@types/uuid": "^8.3.0",
    "@types/validator": "^13.7.1",
    "@typescript-eslint/eslint-plugin": "^3.9.1",
    "@typescript-eslint/parser": "^3.8.0",
    "cross-env": "^7.0.3",
    "eslint": "^7.19.0",
    "eslint-plugin-import": "^2.22.0",
    "firebase-functions-test": "^0.2.0",
    "lint-staged": "^12.3.4",
    "pre-commit": "^1.2.2",
    "prettier": "^2.5.1",
    "typescript": "^5.3.3"
  },
  "private": true
}
PuneetKohli commented 6 months ago

+1 on this issue

dougwilson commented 6 months ago

Is this an issue with typescript typings? They are part of the DefinitelyTyped project, and not part of this repo. If it is something else, I'm sorry, as I'm not familiar with the error if someone can give a way for me to reproduce it.