DenoDDeno
Powered by
NReilinghN
Denoβ€’3y ago
NReilingh

LSP: Uncached or missing @types/node when importing node:process

I'd like to understand better what's going on here in case it's a potential bug in node interop:
// test.ts
import process from 'node:process';
console.log("arch is", process.arch);
// test.ts
import process from 'node:process';
console.log("arch is", process.arch);

The LSP flags
node:process
node:process
with
Uncached or missing npm package: @types/node
Uncached or missing npm package: @types/node
. Running
deno cache test.ts
deno cache test.ts
does not change anything, but if I manually run the same commands in a
deno repl
deno repl
, I notice a status message appear after running the import:
Download https://registry.npmjs.org/@types/node
Download https://registry.npmjs.org/@types/node
. After doing this in the repl, then I can reload the LSP and it no longer flags this line.

It appears to me that the repl knows that it needs to download
@types/node
@types/node
, but
deno cache
deno cache
does not. I don't believe I need to explicitly import
@types/node
@types/node
in my
test.ts
test.ts
, because it executes the same way whether or not I have cached the types using the repl workaround (I tested this by trashing
~/Library/Caches/deno
~/Library/Caches/deno
a few times).
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

LSP becomes slow when importing large json
phoenisxPphoenisx / help
4y ago
Deno LSP not narrowing types
BreadBBread / help
8mo ago
importing packages breaks types
lvinLlvin / help
3y ago