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 'bun' or its corresponding type declarations. #1118

Open
grasilife opened this issue Mar 9, 2025 · 1 comment
Open

Cannot find module 'bun' or its corresponding type declarations. #1118

grasilife opened this issue Mar 9, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@grasilife
Copy link

What version of Elysia is running?

"elysia": "^1.2.25"

What platform is your computer?

Darwin 24.3.0 arm64 arm

What steps can reproduce the bug?

https://elysiajs.com/quick-start.html
(base) fuguoqiang@fuguoqiangdeMacBook-Air 未命名文件夹 % npm run build

build
tsc src/index.ts --outDir dist

node_modules/@elysiajs/node/dist/handler.d.ts:3:30 - error TS2307: Cannot find module 'elysia/context' or its corresponding type declarations.
There are types at '/Users/fuguoqiang/Desktop/未命名文件夹/node_modules/elysia/dist/context.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

3 import type { Context } from 'elysia/context';
~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/handler.d.ts:4:44 - error TS2307: Cannot find module 'elysia/types' or its corresponding type declarations.
There are types at '/Users/fuguoqiang/Desktop/未命名文件夹/node_modules/elysia/dist/types.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

4 import type { HTTPHeaders, Prettify } from 'elysia/types';
~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:19:35 - error TS2307: Cannot find module 'elysia/sucrose' or its corresponding type declarations.
There are types at '/Users/fuguoqiang/Desktop/未命名文件夹/node_modules/elysia/dist/sucrose.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

19 declare(inference: import("elysia/sucrose").Sucrose.Inference): string | undefined;
~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:26:56 - error TS2307: Cannot find module 'formidable/Formidable' or its corresponding type declarations.

26 (options?: formidable.Options): import("formidable/Formidable");
~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:45:37 - error TS2307: Cannot find module 'formidable/PersistentFile' or its corresponding type declarations.

45 File: typeof import("formidable/PersistentFile");
~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:46:47 - error TS2307: Cannot find module 'formidable/PersistentFile' or its corresponding type declarations.

46 PersistentFile: typeof import("formidable/PersistentFile");
~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:47:45 - error TS2307: Cannot find module 'formidable/VolatileFile' or its corresponding type declarations.

47 VolatileFile: typeof import("formidable/VolatileFile");
~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:48:43 - error TS2307: Cannot find module 'formidable/Formidable' or its corresponding type declarations.

48 Formidable: typeof import("formidable/Formidable");
~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:49:70 - error TS2307: Cannot find module 'formidable/Formidable' or its corresponding type declarations.

49 formidable: (options?: formidable.Options) => import("formidable/Formidable");
~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:50:45 - error TS2307: Cannot find module 'formidable/Formidable' or its corresponding type declarations.

50 IncomingForm: typeof import("formidable/Formidable");
~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:51:40 - error TS2307: Cannot find module 'formidable/parsers' or its corresponding type declarations.

51 parsers: typeof import("formidable/parsers");
~~~~~~~~~~~~~~~~~~~~

node_modules/@elysiajs/node/dist/index.d.ts:93:78 - error TS2307: Cannot find module 'elysia/universal/server' or its corresponding type declarations.
There are types at '/Users/fuguoqiang/Desktop/未命名文件夹/node_modules/elysia/dist/universal/server.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

93 listen(app: import("elysia").AnyElysia): (options: any, callback: import("elysia/universal/server").ListenCallback | undefined) => void;
~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@sinclair/typebox/build/cjs/value/assert/assert.d.ts:6:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.

6 #private;
~~~~~~~~

node_modules/elysia/dist/context.d.ts:1:29 - error TS2307: Cannot find module 'bun' or its corresponding type declarations.

1 import type { Server } from 'bun';
~~~~~

node_modules/elysia/dist/context.d.ts:115:245 - error TS2536: Type '{ readonly Continue: 100; readonly 'Switching Protocols': 101; readonly Processing: 102; readonly 'Early Hints': 103; readonly OK: 200; readonly Created: 201; readonly Accepted: 202; readonly 'Non-Authoritative Information': 203; ... 51 more ...; readonly 'Network Authentication Required': 511; }[Code]' cannot be used to index type 'Route["response"]'.

115 error: <const Code extends keyof Route['response'] | InvertedStatusMap[Extract<InvertedStatusMapKey, keyof Route['response']>], const T extends Code extends keyof Route['response'] ? Route['response'][Code] : Code extends keyof StatusMap ? Route['response'][StatusMap[Code]] : never>(code: Code, response: T) => ElysiaCustomStatusResponse<Code, T>;

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

No response

@grasilife grasilife added the bug Something isn't working label Mar 9, 2025
@hisamafahri
Copy link
Contributor

Becaus Elysia is built on top of bun.

I am not sure why you want to use tsc and npm to build it.

You can follow the official guides for documentation here or if you want to integrate with node, you can use node adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants