summaryrefslogtreecommitdiff
path: root/cli/npm/resolvers
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-13 10:03:19 -0400
committerGitHub <noreply@github.com>2023-03-13 14:03:19 +0000
commit11f225ef7d8d51a048c11c57f47674e1c5bb6f3e (patch)
treee6f4e823a8f91d29fa871f33bd9bb82c750fb9a8 /cli/npm/resolvers
parent983447e860529d1b95ed68eee5aae1696c11d2bd (diff)
fix: ensure no node_modules directory is created when a package.json exists and no npm dependencies are used (#18134)
Closes #18133 Closes #18038
Diffstat (limited to 'cli/npm/resolvers')
-rw-r--r--cli/npm/resolvers/local.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/npm/resolvers/local.rs b/cli/npm/resolvers/local.rs
index 89f5decd8..3e2710165 100644
--- a/cli/npm/resolvers/local.rs
+++ b/cli/npm/resolvers/local.rs
@@ -236,6 +236,10 @@ async fn sync_resolution_with_fs(
registry_url: &Url,
root_node_modules_dir_path: &Path,
) -> Result<(), AnyError> {
+ if snapshot.is_empty() {
+ return Ok(()); // don't create the directory
+ }
+
let deno_local_registry_dir = root_node_modules_dir_path.join(".deno");
fs::create_dir_all(&deno_local_registry_dir).with_context(|| {
format!("Creating '{}'", deno_local_registry_dir.display())