function getPackagePath (pkgName, dir) {
  if (dir === void 0) {
    console.error('getPackagePath() -> dir param is required')
    process.exit(1)
  }

  try {
    return resolvePathSync(pkgName, { url: dir })
  }
  catch (_) {
    /* do nothing, let the next method try as well */
  }

  try {
    return require.resolve(pkgName, {
      paths: [ dir ]
    })
  }
  catch (_) {
    /* do and return nothing */
  }
}
Get the resolved path of a host package.