From 3d0e1b65b1e1a754f6440fff1df873da8b2144a1 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Thu, 11 Jul 2024 11:39:45 -0700 Subject: fix(node): Ignore broken default install scripts (#24534) NPM inserts a default install script when a package has a `binding.gyp` file. It's possible, however, for the package to exclude the `binding.gyp` file when they publish, and in this case the install script will never succeed for a user of the package. This happens with `fsevents`, for instance. They don't include the `binding.gyp` file in their published tarball, but the default install script appears in the manifest served by `npm`. This causes us to warn that `fsevents` has an install script, but when you try to run it it fails due to `binding.gyp` not existing. --- tests/specs/npm/lifecycle_scripts/__test__.jsonc | 15 +++++++++++++++ tests/specs/npm/lifecycle_scripts/fsevents.js | 1 + tests/specs/npm/lifecycle_scripts/fsevents.out | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 tests/specs/npm/lifecycle_scripts/fsevents.js create mode 100644 tests/specs/npm/lifecycle_scripts/fsevents.out (limited to 'tests/specs') diff --git a/tests/specs/npm/lifecycle_scripts/__test__.jsonc b/tests/specs/npm/lifecycle_scripts/__test__.jsonc index 18a2d405e..5639c83cd 100644 --- a/tests/specs/npm/lifecycle_scripts/__test__.jsonc +++ b/tests/specs/npm/lifecycle_scripts/__test__.jsonc @@ -104,6 +104,21 @@ "output": "conflicting_bin.out" } ] + }, + "fsevents_default_install_script": { + "tempDir": true, + "steps": [ + { + "if": "mac", + "args": "cache fsevents.js", + "output": "fsevents.out" + }, + { + "if": "mac", + "args": "cache --allow-scripts fsevents.js", + "output": "" + } + ] } } } diff --git a/tests/specs/npm/lifecycle_scripts/fsevents.js b/tests/specs/npm/lifecycle_scripts/fsevents.js new file mode 100644 index 000000000..45ddf686f --- /dev/null +++ b/tests/specs/npm/lifecycle_scripts/fsevents.js @@ -0,0 +1 @@ +import {} from "npm:fsevents"; diff --git a/tests/specs/npm/lifecycle_scripts/fsevents.out b/tests/specs/npm/lifecycle_scripts/fsevents.out new file mode 100644 index 000000000..021886593 --- /dev/null +++ b/tests/specs/npm/lifecycle_scripts/fsevents.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/fsevents +Download http://localhost:4260/fsevents/fsevents-2.3.3.tgz +Initialize fsevents@2.3.3 -- cgit v1.2.3