summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-06-12 16:06:41 -0700
committerGitHub <noreply@github.com>2024-06-12 16:06:41 -0700
commita7531361ef9bcc29b31ca73b68eeae707ea91f22 (patch)
treeea212f7d1fc4bc20d1facf6434672afecaffefe4 /cli
parentb30e5c09859000896a0caf52e78b0cbdb58955ef (diff)
fix(cli): Explicitly cache NPM packages during `deno install` (#24190)
Fixes a regression introduced in https://github.com/denoland/deno/pull/24170, where we wouldn't actually set up the node modules dir on `deno install` if there was an up to date deno lockfile present. Previously we were relying on the fact that resolving pending module resolution called `cache_packages` (which sets up the node modules dir). When pending resolutions were removed, and the `resolve_pending` function with it, we also removed the `cache_packages` call needed to set up node modules.
Diffstat (limited to 'cli')
-rw-r--r--cli/module_loader.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/module_loader.rs b/cli/module_loader.rs
index 1da3f1f2a..5752c50aa 100644
--- a/cli/module_loader.rs
+++ b/cli/module_loader.rs
@@ -75,6 +75,9 @@ pub async fn load_top_level_deps(factory: &CliFactory) -> Result<(), AnyError> {
let npm_resolver = factory.npm_resolver().await?;
if let Some(npm_resolver) = npm_resolver.as_managed() {
npm_resolver.ensure_top_level_package_json_install().await?;
+ // TODO(nathanwhit): we call `cache_packages` if the lockfile is modified,
+ // so by calling it here it's possible we end up calling it twice
+ npm_resolver.cache_packages().await?;
}
// cache as many entries in the import map as we can
if let Some(import_map) = factory.maybe_import_map().await? {