From 7fdc3c8f1fc27be2ca7d4ff62b9fd8ecb3d24e61 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 6 Dec 2023 16:25:24 -0500 Subject: fix(compile/npm): ignore symlinks to non-existent paths in node_modules directory (#21479) Part of https://github.com/denoland/deno/issues/21476 --- cli/standalone/binary.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/standalone/binary.rs') 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 { + 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(); -- cgit v1.2.3