firebase-admin-node: TS2688: Cannot find type definition file for 'mime'

[READ] Step 1: Are you in the right place?

  • For issues related to the code in this repository file a Github issue.

[REQUIRED] Step 2: Describe your environment

  System:
    OS: macOS 14.3.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 789.16 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.2.5 - /usr/local/bin/npm
    bun: 1.0.36 - ~/.bun/bin/bun
  Browsers:
    Chrome: 123.0.6312.87
    Edge: 123.0.2420.65
    Safari: 17.3.1
  npmPackages:
    @aws-sdk/client-cloudwatch-logs: ^3.540.0 => 3.540.0 
    @aws-sdk/client-ecs: ^3.540.0 => 3.542.0 
    @aws-sdk/client-lambda: ^3.540.0 => 3.540.0 
    @aws-sdk/client-s3: ^3.540.0 => 3.540.0 
    @aws-sdk/s3-request-presigner: ^3.540.0 => 3.540.0 
    @bloxtax/extras: ^1.0.7 => 1.0.7 
    @graphql-yoga/plugin-response-cache: ^3.4.0 => 3.5.0 
    @pothos/core: ^3.41.0 => 3.41.0 
    @pothos/plugin-dataloader: ^3.18.1 => 3.18.1 
    @pothos/plugin-prisma: ^3.65.0 => 3.65.0 
    @prisma/client: ^5.11.0 => 5.11.0 
    @sendgrid/mail: ^8.1.1 => 8.1.1 
    @solana/web3.js: ^1.91.1 => 1.91.2 
    @types/crypto-js: ^4.2.2 => 4.2.2 
    @types/node: ^20.11.30 => 20.12.2 
    @types/pg: ^8.11.4 => 8.11.4 
    @types/uuid: ^9.0.8 => 9.0.8 
    @whatwg-node/server-plugin-cookies: ^1.0.2 => 1.0.2 
    axios: ^1.6.8 => 1.6.8 
    crypto-js: ^4.2.0 => 4.2.0 
    dataloader: ^2.2.2 => 2.2.2 
    dayjs: ^1.11.10 => 1.11.10 
    dotenv: ^16.4.5 => 16.4.5 
    firebase-admin: ^12.0.0 => 12.0.0 
    form-data: ^4.0.0 => 4.0.0 
    graphql: ^16.8.1 => 16.8.1 
    graphql-middleware: ^6.1.35 => 6.1.35 
    graphql-request: ^6.1.0 => 6.1.0 
    graphql-scalars: ^1.23.0 => 1.23.0 
    graphql-shield: ^7.6.5 => 7.6.5 
    graphql-yoga: ^5.2.0 => 5.3.0 
    knex: ^3.1.0 => 3.1.0 
    libphonenumber-js: ^1.10.58 => 1.10.59 
    node-object-hash: ^3.0.0 => 3.0.0 
    pg: ^8.11.3 => 8.11.4 
    prisma: ^5.11.0 => 5.11.0 
    query-string: ^9.0.0 => 9.0.0 
    redis: ^4.6.13 => 4.6.13 
    ts-node: ^10.9.2 => 10.9.2 
    ts-node-dev: ^2.0.0 => 2.0.0 
    typescript: ^5.4.3 => 5.4.3 
    uuid: ^9.0.1 => 9.0.1 
    web3-validator: ^2.0.4 => 2.0.5 
    xlsx: https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz => 0.20.1

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  1. Install firebase-admin@latest in node typescript project.
  2. Run “tsc” (build).
error TS2688: Cannot find type definition file for 'mime'.
  The file is in the program because:
    Entry point for implicit type library 'mime'

When I remove “firebase-admin” - there is no type error.

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Reactions: 6
  • Comments: 26 (1 by maintainers)

Commits related to this issue

Most upvoted comments

yarn

“resolutions”: { “@types/mime”: “3.0.4” }

npm

“overrides”: { “@types/mime”: “3.0.4” }

更新@types/mime@4.0.0 导致了我的问题,您可以通过强制解析@3.0.4 来解决。

怎么强行呢。因为我没有安装@types/mime@4.0.0

add to package.json :

“resolutions”: { “@types/mime”: “3.0.4” }

yarn add @types/mime@3 worked for me.

I am not sure what the issue with @types/mime is yet. But to get around this temporariliy add the following to package json

“overrides”: { “@types/mime”: “3.0.4” }

Thanks folks for flagging this issue. I believe https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69231 should fix it, and from what I understand there is no fix to be made in this repository.

Update to @types/mime@4.0.0 caused the issue for me, you can resolve by forcing resolution of @3.0.4.


Works here very well, thanks!

 "resolutions": {
    "@types/mime": "3.0.4"
}