anchor.diff:        # We point the registry at something that doesn't exist. This will
         # mean that NPM will fail if any of the dependencies aren't met, as it
         # will attempt to hit this registry for the missing dependency.
  -      "--registry=fakeprotocol://notaregistry.$UNIQNAME.derp"
  +      "--registry=http://notaregistry.$UNIQNAME.derp"
         # These flags make failure fast, as otherwise NPM will spin for a while.
         "--fetch-retry-mintimeout=0"
         "--fetch-retry-maxtimeout=10"
  
positive.code: else
  
  let
    inherit (stdenv.lib) fold removePrefix hasPrefix subtractLists isList flip
                         intersectLists isAttrs listToAttrs nameValuePair
                         mapAttrs filterAttrs attrNames elem concatMapStrings
  
negative.code:           cd $BUILD_DIR
            # NPM reads the `HOME` environment variable and fails if it doesn't
            # exist, so set it here.
            (HOME=$PWD npm install $PATCHED_SRC ${npmFlags}) || {
              echo
              echo
              echo "NPM installation failed!"
              echo "The command was:"
              echo HOME=$PWD npm install $PATCHED_SRC ${npmFlags}
              echo
              echo
              echo
              # Drop the package's package.json file that we picked up before;
              # the `npm list` command will read this file and tell us if any
              # dependencies are missing or invalid (which is probably the reason
              # for failure).
              echo "$PACKAGE_JSON" > package.json
              echo "The following output might be helpful in understanding why:"
              npm list
              exit 1
            }
  