denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.06k stars 5.14k forks source link

"Could not set npm package requirements" when lock:false in deno.json #23734

Closed guy-borderless closed 1 week ago

guy-borderless commented 1 week ago

Version: Deno 1.43.1 In my project I have deno.json with lock: false. Some dependencies fail to cache with Could not set npm package requirements. Error getting a response at https://registry.npmjs.org/@types/node for package "@types/node": An npm specifier not found in cache: "@types/node", --cached-only is specified. or in a different project with the same problem Could not set npm package requirements. Error getting response at https://registry.npmjs.org/@tailwindcss/typography for package "@tailwindcss/typography": An npm specifier not found in cache: "@tailwindcss/typography", --cached-only is specified. I don't know why it started happening, I tried deleting the cache dir, downgrading deno, ext. project still runs fine, this is only in the lsp. changing to lock:true fixes the issue.

The errors still show in the deno output view, but the dependency is shown as cached in the editor. Not sure if related, but I also see this errors which is strange: Hit the language server document preload limit of **100000** file system entries. You may want to use the "deno.enablePaths" configuration setting to only have Deno partially enable a workspace or increase the limit via "deno.documentPreloadLimit". In cases where Deno ends up using too much memory, you may want to lower the limit. It's not that big a project I just put the 100000 limit to see if this warning shows regardless.

dsherret commented 1 week ago

Are you talking about in the LSP? This is probably a duplicate of https://github.com/denoland/deno/issues/23659

It is probably fixed in deno upgrade --canary and will be released later today.

guy-borderless commented 1 week ago

indeed

guy-borderless commented 1 week ago

Actually, having deleted the deno.lock, seems the problem is still there ( just changed to lock:false before and forgot to delete deno.lock) image

dsherret commented 1 week ago

What happens after you cache the dependencies by running "Deno: Cache dependencies" from the vscode command pallete?

By the way, I wouldn't recommend using lock: false with npm packages. It causes everything to be much slower because it doesn't cache the npm resolution in the lockfile.

guy-borderless commented 1 week ago

What happens after you cache the dependencies by running "Deno: Cache dependencies" from the vscode command pallete?

By the way, I wouldn't recommend using lock: false with npm packages. It causes everything to be much slower because it doesn't cache the npm resolution in the lockfile.

image

dsherret commented 1 week ago

What happens when you go to https://registry.npmjs.org/@types/node? Sometimes the npm registry is flaky. It looks like it's attempting to download then the connection is closed (the error on the last line is just what occurs after caching was attempted). You may need to try caching a few times.

If that doesn't work, do you have a repo that we could try reproducing in?

guy-borderless commented 1 week ago

What happens when you go to https://registry.npmjs.org/@types/node? Sometimes the npm registry is flaky. It looks like it's attempting to download then the connection is closed (the error on the last line is just what occurs after caching was attempted). You may need to try caching a few times.

If that doesn't work, do you have a repo that we could try reproducing

I tried that, the url always works.