Subject: [bug#49946] [PATCH 08/31] gnu: node: Patch /usr/bin/env in node-gyp.

From: Pierre Langlois <[email-masked]>
Date: Mon, 9 Aug 2021 00:33:31 +0100

* gnu/packages/node.scm (node)[arguments]: Fix /usr/bin/env shebang in
node-gyp.js.
(node-lts)[arguments]: Ditto.
---
 gnu/packages/node.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 36c45e9c7a..522d4943d0 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2017 Mike Gerwitz <[email-masked]>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018, 2019, 2020, 2021 Marius Bakke <[email-masked]>
-;;; Copyright © 2020 Pierre Langlois <[email-masked]>
+;;; Copyright © 2020, 2021 Pierre Langlois <[email-masked]>
 ;;; Copyright © 2020 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2021 Simon Tournier <[email-masked]>
 ;;;
@@ -120,6 +120,10 @@
                (("'/usr/bin/env'")
                 (string-append "'" (which "env") "'")))

+             ;; Fix /usr/bin/env shebang in node-gyp.
+             (substitute* "deps/npm/node_modules/node-gyp/bin/node-gyp.js"
+               (("#!/usr/bin/env") (string-append "#!" (which "env"))))
+
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
              (for-each delete-file
@@ -661,6 +665,10 @@ source files.")
                  (("'/usr/bin/env'")
                   (string-append "'" (which "env") "'")))

+               ;; Fix /usr/bin/env shebang in node-gyp.
+               (substitute* "deps/npm/node_modules/node-gyp/bin/node-gyp.js"
+                 (("#!/usr/bin/env") (string-append "#!" (which "env"))))
+
                ;; FIXME: These tests fail in the build container, but they don't
                ;; seem to be indicative of real problems in practice.
                (for-each delete-file
--
2.32.0