AndyOh
AndyOh

Reputation: 117

pnpm firebase app "Could not find a declaration file for module 'mime'"

I'm trying to switch from yarn to pnpm in my turborepo monorepo. When running lint or build I get this error:

../../node_modules/.pnpm/@[email protected]/node_modules/@types/serve-static/index.d.ts:4:20 
- error TS7016: Could not find a declaration file for module 'mime'. 
'/path-to-project/node_modules/.pnpm/[email protected]/node_modules/mime/index.js' implicitly has an 'any' type.

It looks like some levels down my dependency graph @types/mime is installed but it is both deprecated and redundant, as stated on the npm page: This is a stub types definition. mime provides its own type definitions, so you do not need this installed

Digging into root/node_modules/.pnpm and root/pnpm-lock.yaml the dependency leading to the issue seems to look like:

[email protected] --> @types/[email protected] --> @types/[email protected] --> @types/[email protected]

I have tried:

Any ideas why I am getting this issue?

pnpm v8.15.5

root/apps/project/tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compil

eOnSave": true, "include": [ "src" ] }

root/apps/project/package.json

  "dependencies": {
    "firebase-admin": "^12.0.0",
    "firebase-functions": "^4.8.2"
  },
  "devDependencies": {
    "event-dee-types": "workspace:*",
    "firebase-functions-test": "^3.1.1",
    "typescript": "^4.9.0"
  },

root/package.json

 "dependencies": {
    "daisyui": "4.6.0",
    "dotenv-cli": "^7.2.1",
    "next": "latest",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/node": "^20.10.4",
    "@types/react": "^18.0.22",
    "@types/react-dom": "^18.0.7",
    "autoprefixer": "^10.4.14",
    "eslint": "^7.32.0",
    "eslint-config-custom": "workspace:*",
    "postcss": "^8.4.21",
    "sass": "^1.62.0",
    "tailwindcss": "^3.3.1",
    "turbo": "latest",
    "typescript": "^5.0.4"
  }

Upvotes: 1

Views: 322

Answers (1)

Bilal
Bilal

Reputation: 1

You can remove by using the following command:

pnpm remove @types/mime

Upvotes: 0

Related Questions