getPrefix = mod => {
  const i = mod.lastIndexOf(n);
  return i !== -1 ? mod.slice(0, i + n.length) : '';
}
Returns the path up to the last occurence of `node_modules` or an
empty string if the path does not contain a node_modules dir.