summaryrefslogtreecommitdiff
path: root/cli/npm
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-08-09 15:35:54 +0200
committerGitHub <noreply@github.com>2024-08-09 13:35:54 +0000
commit854c7ba1980e949642c7240f38318cdd31f0113c (patch)
treef1dff979463f5fee6cb33cc52c2f3b9f00edf22a /cli/npm
parentf474c4f4ff2db301573a228fba0b65f9f4970f8c (diff)
fix(install): Properly handle dist tags when setting up node_modules (#24968)
Fixes https://github.com/denoland/deno/issues/24966. Fixes https://github.com/denoland/deno/issues/24932.
Diffstat (limited to 'cli/npm')
-rw-r--r--cli/npm/managed/resolvers/local.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/cli/npm/managed/resolvers/local.rs b/cli/npm/managed/resolvers/local.rs
index 7687e23f8..adfd04b9e 100644
--- a/cli/npm/managed/resolvers/local.rs
+++ b/cli/npm/managed/resolvers/local.rs
@@ -612,12 +612,21 @@ async fn sync_resolution_with_fs(
// 4. Create symlinks for package json dependencies
{
for remote in pkg_json_deps_provider.remote_pkgs() {
- let Some(remote_id) = snapshot
+ let remote_pkg = if let Ok(remote_pkg) =
+ snapshot.resolve_pkg_from_pkg_req(&remote.req)
+ {
+ remote_pkg
+ } else if remote.req.version_req.tag().is_some() {
+ // couldn't find a match, and `resolve_best_package_id`
+ // panics if you give it a tag
+ continue;
+ } else if let Some(remote_id) = snapshot
.resolve_best_package_id(&remote.req.name, &remote.req.version_req)
- else {
+ {
+ snapshot.package_from_id(&remote_id).unwrap()
+ } else {
continue; // skip, package not found
};
- let remote_pkg = snapshot.package_from_id(&remote_id).unwrap();
let alias_clashes = remote.req.name != remote.alias
&& newest_packages_by_name.contains_key(&remote.alias);
let install_in_child = {