diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-12-06 16:25:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-06 16:25:24 -0500 |
commit | 7fdc3c8f1fc27be2ca7d4ff62b9fd8ecb3d24e61 (patch) | |
tree | e0de42001e5185091e00dd0232d82f98621edd14 /cli/standalone/binary.rs | |
parent | 07f78912d629eb788cd9feca344e6b4720a3bef3 (diff) |
fix(compile/npm): ignore symlinks to non-existent paths in node_modules directory (#21479)
Part of https://github.com/denoland/deno/issues/21476
Diffstat (limited to 'cli/standalone/binary.rs')
-rw-r--r-- | cli/standalone/binary.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index d1a5863ee..de7b3f6ec 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -568,9 +568,16 @@ impl<'a> DenoCompileBinaryWriter<'a> { } fn build_vfs(&self) -> Result<VfsBuilder, AnyError> { + fn maybe_warn_different_system(system_info: &NpmSystemInfo) { + if system_info != &NpmSystemInfo::default() { + log::warn!("{} The node_modules directory may be incompatible with the target system.", crate::colors::yellow("Warning")); + } + } + match self.npm_resolver.as_inner() { InnerCliNpmResolverRef::Managed(npm_resolver) => { if let Some(node_modules_path) = npm_resolver.root_node_modules_path() { + maybe_warn_different_system(&self.npm_system_info); let mut builder = VfsBuilder::new(node_modules_path.clone())?; builder.add_dir_recursive(node_modules_path)?; Ok(builder) @@ -593,6 +600,7 @@ impl<'a> DenoCompileBinaryWriter<'a> { } } InnerCliNpmResolverRef::Byonm(npm_resolver) => { + maybe_warn_different_system(&self.npm_system_info); // the root_node_modules directory will always exist for byonm let node_modules_path = npm_resolver.root_node_modules_path().unwrap(); let parent_path = node_modules_path.parent().unwrap(); |