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 'node:net' or its corresponding type declarations. #65

Closed
DoodahProductions opened this issue Mar 1, 2022 · 3 comments

Comments

@DoodahProductions
Copy link

Hello, I do encounter this issue :

node_modules/get-port/index.d.ts:1:29 - error TS2307: Cannot find module 'node:net' or its corresponding type declarations.

1 import {ListenOptions} from 'node:net';

Node version : v17.6.0

Thanks for your work on this package.

@sindresorhus
Copy link
Owner

Sounds like you have outdated Node.js types.

@hakonhagland
Copy link

I have the same problem. I tried to google node:net but could not find any information. I tried to reinstall npm install @types/node but it did not solve the problem

@hakonhagland
Copy link

Ok I found that the problem might be that I was using the default setup for writing a VS Code extension. It uses commonjs module types by default. If I change the tsconfig.json to use compiler option "module": "es6" it finds the node:net import, however then I ran into this issue. Which I now believe cannot be solved since get-port is an es module, see the discussion here. Does anyone know if there a simple way to convert this module to a commonjs module so it can be used in a VS Code extension?

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

3 participants