_removeLinks(label, type) {
    let cachedManifest = this._readManifest(label, type);
    if (!cachedManifest) {
      return;
    }

    let jsonManifest = JSON.parse(cachedManifest);
    let links = jsonManifest._packageCache.links;

    // Blindly remove existing links whether or not they appear in the manifest.
    let link, linkPath;
    for (let i = 0; i < links.length; i++) {
      link = links[i];
      if (typeof link === 'string') {
        commands[type].invoke('unlink', link, { cwd: this.dirs[label] });
      } else {
        linkPath = path.join(this.dirs[label], translate(type, 'path'), link.name);
        try {
          fs.removeSync(linkPath);
        } catch (error) {
          // Catch unexceptional error but rethrow if something is truly wrong.
          if (error.code !== 'ENOENT') {
            throw error;
          }
        }
      }
    }

    // Remove things from the manifest which we know we'll link back in.
    let originals = {};
    let key, linkName;
    for (let i = 0; i < DEPENDENCY_KEYS.length; i++) {
      key = DEPENDENCY_KEYS[i];
      if (jsonManifest[key]) {
        // Get a clone of the original object.
        originals[key] = JSON.parse(JSON.stringify(jsonManifest[key]));
      }
      for (let j = 0; j < links.length; j++) {
        link = links[j];

        // Support object-style invocation for "manual" linking.
        if (typeof link === 'string') {
          linkName = link;
        } else {
          linkName = link.name;
        }

        if (jsonManifest[key] && jsonManifest[key][linkName]) {
          delete jsonManifest[key][linkName];
        }
      }
    }

    jsonManifest._packageCache.originals = originals;
    let manifest = JSON.stringify(jsonManifest);

    this._writeManifest(label, type, manifest);
  }
The `_removeLinks` method removes from the dependencies of the manifest the
assets which will be linked in so that we don't duplicate install. It saves
off the values in the internal `PackageCache` metadata for restoration after
linking as those values may be necessary.

It is also responsible for removing these links prior to making any changes
to the specified cache.

@private
@method _removeLinks
@param {String} label The label for the cache.
@param {String} type The type of package cache.