Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Mikey-ShenSu opened this issue Mar 30, 2024 · 10 comments
Closed

Comments

@Mikey-ShenSu
Copy link

Mikey-ShenSu commented Mar 30, 2024

{
  "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
Copy link
Owner

#12

@Mikey-ShenSu
Copy link
Author

#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
Copy link
Owner

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
Copy link

RappyTV commented Mar 31, 2024

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
Copy link

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
Copy link
Owner

I don't get it either

@doroved
Copy link

doroved commented Apr 9, 2024

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
Copy link

RappyTV commented Apr 9, 2024

agree

@gaurishhs
Copy link
Owner

gaurishhs commented Apr 10, 2024

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
Copy link
Owner

Fixed in latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants