about summary refs log tree commit diff
path: root/pkgs/development/web
diff options
context:
space:
mode:
authorValérian Galliat <val@codejam.info>2015-02-07 15:04:35 +0100
committerValérian Galliat <val@codejam.info>2015-02-07 15:17:15 +0100
commit25ce27b45e219ca8e13e5737a5d5b175ac7548fb (patch)
treeaaaafc09a191133a6a581829bd07c46f29fc4564 /pkgs/development/web
parent9792b12e5355a3f2b11e579fce27a2b97646c468 (diff)
downloadnixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.tar
nixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.tar.gz
nixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.tar.bz2
nixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.tar.lz
nixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.tar.xz
nixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.tar.zst
nixlib-25ce27b45e219ca8e13e5737a5d5b175ac7548fb.zip
Patch npm packages to ignore npm requirements
Some npm packages strictly require a specific npm version because npm
don't handle some version requirements the same way in 1.0 and 2.0.

However, Nix don't use npm for dependency resolution (this is always
achieved with npm 1.0 criteria by npm2nix), so these requirements turns
out to be pointless and just crashes some package installations.

This patch removes npm requirements so the packages can still be built.

This solves #5787.
Diffstat (limited to 'pkgs/development/web')
-rw-r--r--pkgs/development/web/nodejs/build-node-package.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/development/web/nodejs/build-node-package.nix b/pkgs/development/web/nodejs/build-node-package.nix
index af997f19e8d3..e385c0d40c44 100644
--- a/pkgs/development/web/nodejs/build-node-package.nix
+++ b/pkgs/development/web/nodejs/build-node-package.nix
@@ -83,6 +83,9 @@ let
       # Some version specifiers (latest, unstable, URLs, file paths) force NPM
       # to make remote connections or consult paths outside the Nix store.
       # The following JavaScript replaces these by * to prevent that:
+      # Also some packages require a specific npm version because npm may
+      # resovle dependencies differently, but npm is not used by Nix for dependency
+      # reslution, so these requirements are dropped.
 
       (
       cat <<EOF
@@ -131,6 +134,11 @@ let
             }
         }
 
+        /* Ignore npm version requirement */
+        if(packageObj.engines) {
+            delete packageObj.engines.npm;
+        }
+
         /* Write the fixed JSON file */
         fs.writeFileSync("package.json", JSON.stringify(packageObj));
       EOF