gaurishhs / elysia-ip

Get Client IP Address in Elysia
MIT License
53 stars 10 forks source link

Cannot find module 'elysia-ip' or its corresponding type declarations. #14

Closed Mikey-ShenSu closed 6 months ago

Mikey-ShenSu commented 7 months ago
{
  "name": "study-app",
  "version": "1.0.50",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "bun run --watch src/index.ts",
    "start": "NODE_ENV=production bun run src/index.ts"
  },
  "dependencies": {
    "@elysiajs/bearer": "^1.0.2",
    "@elysiajs/cors": "^1.0.2",
    "@elysiajs/jwt": "^1.0.2",
    "@elysiajs/static": "^1.0.2",
    "@elysiajs/swagger": "^0.8.5",
    "@types/pluralize": "^0.0.33",
    "elysia": "^1.0.10",
    "mongoose": "^8.2.1",
    "pluralize": "^8.0.0",
    "tencentcloud-sdk-nodejs-sms": "^4.0.789",
    "uuid": "^9.0.1"
  },
  "devDependencies": {
    "@types/uuid": "^9.0.8",
    "bun-types": "latest"
  },
  "module": "src/index.js"
}

I don't know what is causing the issue.

Screenshot 2024-03-31 at 06 33 09

gaurishhs commented 7 months ago

12

Mikey-ShenSu commented 7 months ago

12

I believe I am already in the latest version, and "main": "./dist/index.js" is added by default in the latest update, still no luck for me :(.

{
  "name": "elysia-ip",
  "version": "1.0.2",
  "type": "module",
  "author": {
    "name": "Gaurish Sethia",
    "url": "https://github.com/gaurishhs",
    "email": "gaurishh.sethia@gmail.com"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/gaurishhs/elysia-ip"
  },
  "exports": {
    "main": "./dist/index.js",
    "require": "./dist/index.js",
    "import": "./dist/index.js",
    "node": "./dist/index.js",
    "default": "./dist/index.js",
    "types": "./dist/index.d.ts"
  },
  "bugs": "https://github.com/gaurishhs/elysia-ip/issues",
  "homepage": "https://github.com/gaurishhs/elysia-ip",
  "keywords": [
    "elysia",
    "typescript",
    "ip"
  ],
  "scripts": {
    "build": "tsc",
    "lint": "eslint . --ext .ts"
  },
  "license": "MIT",
  "devDependencies": {
    "@types/bun": "^1.0.2",
    "@typescript-eslint/eslint-plugin": "^6.7.4",
    "@typescript-eslint/parser": "^6.7.4",
    "elysia": "^1.0.9",
    "eslint": "^8.50.0",
    "typescript": "^5.3.3"
  },
  "peerDependencies": {
    "elysia": ">= 1.0.9"
  }
}
gaurishhs commented 7 months ago

This fix worked for someone else as well which is why i published it. It follows the convention as well, so irdk what the problem might be

RappyTV commented 7 months ago

i have the same problem and I just found a solution. i don't know why, but when I copy the "main": "./dist/index.js" into the "main object" (idk how to call it) it works. looks like this now:

{
  "name": "elysia-ip",
  "version": "1.0.2",
  "type": "module",
  "author": {
    "name": "Gaurish Sethia",
    "url": "https://github.com/gaurishhs",
    "email": "gaurishh.sethia@gmail.com"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/gaurishhs/elysia-ip"
  },
  "main": "./dist/index.js",
  "exports": {
    "main": "./dist/index.js",
    "require": "./dist/index.js",
    "import": "./dist/index.js",
    "node": "./dist/index.js",
    "default": "./dist/index.js",
    "types": "./dist/index.d.ts"
  },
  "bugs": "https://github.com/gaurishhs/elysia-ip/issues",
  "homepage": "https://github.com/gaurishhs/elysia-ip",
  "keywords": [
    "elysia",
    "typescript",
    "ip"
  ],
  "scripts": {
    "build": "tsc",
    "lint": "eslint . --ext .ts"
  },
  "license": "MIT",
  "devDependencies": {
    "@types/bun": "^1.0.2",
    "@typescript-eslint/eslint-plugin": "^6.7.4",
    "@typescript-eslint/parser": "^6.7.4",
    "elysia": "^1.0.9",
    "eslint": "^8.50.0",
    "typescript": "^5.3.3"
  },
  "peerDependencies": {
    "elysia": ">= 1.0.9"
  }
}
kwaitsing commented 7 months ago

i have the same problem and I just found a solution. i don't know why, but when I copy the "main": "./dist/index.js" into the "main object" (idk how to call it) it works. looks like this now:

{
  "name": "elysia-ip",
  "version": "1.0.2",
  "type": "module",
  "author": {
    "name": "Gaurish Sethia",
    "url": "https://github.com/gaurishhs",
    "email": "gaurishh.sethia@gmail.com"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/gaurishhs/elysia-ip"
  },
  "main": "./dist/index.js",
  "exports": {
    "main": "./dist/index.js",
    "require": "./dist/index.js",
    "import": "./dist/index.js",
    "node": "./dist/index.js",
    "default": "./dist/index.js",
    "types": "./dist/index.d.ts"
  },
  "bugs": "https://github.com/gaurishhs/elysia-ip/issues",
  "homepage": "https://github.com/gaurishhs/elysia-ip",
  "keywords": [
    "elysia",
    "typescript",
    "ip"
  ],
  "scripts": {
    "build": "tsc",
    "lint": "eslint . --ext .ts"
  },
  "license": "MIT",
  "devDependencies": {
    "@types/bun": "^1.0.2",
    "@typescript-eslint/eslint-plugin": "^6.7.4",
    "@typescript-eslint/parser": "^6.7.4",
    "elysia": "^1.0.9",
    "eslint": "^8.50.0",
    "typescript": "^5.3.3"
  },
  "peerDependencies": {
    "elysia": ">= 1.0.9"
  }
}

yeah it works for me too, tho idk why

gaurishhs commented 7 months ago

I don't get it either

doroved commented 6 months ago

I did that, it didn't help. It would be ideal, of course, to solve this problem without having to specify anything else anywhere.

image
RappyTV commented 6 months ago

agree

gaurishhs commented 6 months ago

I haven't been able to understand this issue. I have made multiple commits trying to fix this since earlier versions as well. #5 seemed to work for some but soon countering that release was #8 The package.json follows the normal convention as it should so i really don't know what the issue is. It always has been like this since the start, It works for some it doesn't for some.

gaurishhs commented 6 months ago

Fixed in latest version