From dddd4f8f4fc2fd89062b931e533ec30afec504d3 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Tue, 21 Jun 2022 11:52:07 +0200 Subject: [PATCH] fix: handle invalid `files` entry in package.json (#1119) --- src/runtimes/node/utils/detect_native_module.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtimes/node/utils/detect_native_module.ts b/src/runtimes/node/utils/detect_native_module.ts index c67d38fb9..a8e387a7f 100644 --- a/src/runtimes/node/utils/detect_native_module.ts +++ b/src/runtimes/node/utils/detect_native_module.ts @@ -21,7 +21,10 @@ export const isNativeModule = ({ return true } - const hasBinaryFile = files.some((path) => !path.startsWith('!') && extname(path) === '.node') + // Check if files is an array, as we never know (see https://github.com/math-utils/hamming-distance/pull/4) + const hasBinaryFile = Array.isArray(files) + ? files.some((path) => !path.startsWith('!') && extname(path) === '.node') + : false return hasBinaryFile }