bun icon indicating copy to clipboard operation
bun copied to clipboard

Cannot find type definition file for 'mime'. Error on Nestjs Windows

Open xkalf opened this issue 1 year ago • 5 comments

What version of Bun is running?

1.1.0

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

my pacakge.json file

{
  "name": "autosync_backend",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/src/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json",
    "push": "drizzle-kit push:pg",
    "migrate": "drizzle-kit generate:pg",
    "buildup": "docker compose up -d --build",
    "buildp": "docker build -t amroos988/autosync:latest . && docker push amroos988/autosync:latest"
  },
  "dependencies": {
    "@aws-sdk/client-s3": "^3.438.0",
    "@aws-sdk/s3-request-presigner": "^3.438.0",
    "@nestjs/axios": "^3.0.1",
    "@nestjs/common": "^10.0.0",
    "@nestjs/config": "^3.1.1",
    "@nestjs/core": "^10.0.0",
    "@nestjs/event-emitter": "^2.0.3",
    "@nestjs/jwt": "^10.1.1",
    "@nestjs/mapped-types": "*",
    "@nestjs/passport": "^10.0.2",
    "@nestjs/platform-express": "^10.0.0",
    "@nestjs/schedule": "^4.0.0",
    "@nestjs/swagger": "^7.1.14",
    "@ts-rest/core": "^3.33.0",
    "@ts-rest/nest": "^3.33.0",
    "@ts-rest/open-api": "^3.33.0",
    "aws-sdk": "^2.1483.0",
    "axios": "^1.6.2",
    "bcrypt": "^5.1.1",
    "date-fns": "^2.30.0",
    "dotenv": "^16.3.1",
    "drizzle-orm": "^0.30.1",
    "drizzle-zod": "^0.5.1",
    "eslint-plugin-drizzle": "^0.2.1",
    "fast-xml-parser": "^4.3.2",
    "nest-winston": "^1.9.4",
    "passport-jwt": "^4.0.1",
    "passport-local": "^1.0.0",
    "pg": "^8.11.3",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.8.1",
    "winston": "^3.11.0",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.0.0",
    "@nestjs/schematics": "^10.0.0",
    "@nestjs/testing": "^10.0.0",
    "@types/bcrypt": "^5.0.2",
    "@types/express": "^4.17.21",
    "@types/jest": "^29.5.10",
    "@types/node": "^20.10.0",
    "@types/passport-jwt": "^3.0.13",
    "@types/passport-local": "^1.0.38",
    "@types/pg": "^8.10.9",
    "@types/supertest": "^2.0.12",
    "@typescript-eslint/eslint-plugin": "^6.13.1",
    "@typescript-eslint/parser": "^6.13.1",
    "drizzle-kit": "^0.20.14",
    "eslint": "^8.54.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.1",
    "jest": "^29.5.0",
    "prettier": "^3.1.0",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.3",
    "ts-jest": "^29.1.1",
    "ts-loader": "^9.5.1",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "^4.2.0",
    "typescript": "^5.3.3"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

pnpm works well but after bun install and bun start:dev command im getting this error

error TS2688: Cannot find type definition file for 'mime'. The file is in the program because: Entry point for implicit type library 'mime'

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

xkalf avatar Apr 02 '24 03:04 xkalf

Have encountered the same behavior with tsc from Typescript version ^5.4.3

phiko-misc avatar Apr 02 '24 07:04 phiko-misc

I also encountered the same problem, nestjs windows11 bun1.1

youwei997 avatar Apr 02 '24 12:04 youwei997

This error happened to me too. I solved it by changing the version of the transitive dependency @types/mime to an older version. Adding this code to the package.json file.

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

hiroyujin avatar Apr 02 '24 14:04 hiroyujin

yarn add @types/mime worked for me.

8zero7 avatar Apr 02 '24 16:04 8zero7

This error happened to me too. I solved it by changing the version of the transitive dependency @types/mime to an older version. Adding this code to the package.json file.

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

@hiroyujin thank you, it worked for me

kamuran21 avatar Jul 16 '24 10:07 kamuran21