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);

The LSP flags node:process with Uncached or missing npm package: @types/node. Running deno cache test.ts does not change anything, but if I manually run the same commands in a
deno repl
, I notice a status message appear after running the import: 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, but deno cache does not. I don't believe I need to explicitly import @types/node in my 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 a few times).
Was this page helpful?