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 'ws'" for tsc with skipLibCheck disabled #7598

Closed
7 tasks done
teppeis opened this issue Apr 3, 2022 · 1 comment · Fixed by #7605
Closed
7 tasks done

"Cannot find module 'ws'" for tsc with skipLibCheck disabled #7598

teppeis opened this issue Apr 3, 2022 · 1 comment · Fixed by #7605

Comments

@teppeis
Copy link

teppeis commented Apr 3, 2022

Describe the bug

Since v2.9.0, #6093 has reappeared.
tsc throws Cannot find module 'ws' errors when skipLibCheck is disabled in tsconfig.json.
This problem has been resolved once in v2.7.2.

Additionally, if @types/node is not installed, a large number of type errors related to built-in modules occur. This has not been fixed in v2.7.2.

Is this intentional?

Reproduction

https://stackblitz.com/edit/vitejs-vite-dvkc8j?file=package.json&terminal=dev

System Info

System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 71.83 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nodenv/versions/16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nodenv/versions/16.14.2/bin/yarn
    npm: 8.5.0 - ~/.nodenv/versions/16.14.2/bin/npm

Used Package Manager

npm

Logs

> npx tsc

node_modules/vite/dist/node/index.d.ts:51:47 - error TS2307: Cannot find module 'ws' or its corresponding type declarations.

51 import type { WebSocket as WebSocket_2 } from 'ws';
                                                 ~~~~

node_modules/vite/dist/node/index.d.ts:52:54 - error TS2307: Cannot find module 'ws' or its corresponding type declarations.

52 import { WebSocketServer as WebSocketServer_2 } from 'ws';
                                                        ~~~~

Validations

@hornta
Copy link

hornta commented Apr 3, 2022

I confirm. I installed the ws types until it's fixed:
pnpm i @types/ws -D

@bluwy bluwy mentioned this issue Apr 4, 2022
9 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants