src/find-npm.js
function _getPath () {
  return Promise.all([_getPathFromPowerShell(), _getPathFromNpm()])
    .then((results) => {
      const fromNpm = results[1] || ''
      const fromPowershell = results[0] || ''

      // Quickly check if there's an npm folder in there
      const fromPowershellPath = path.join(fromPowershell, 'node_modules', 'npm')
      const fromNpmPath = path.join(fromNpm, 'node_modules', 'npm')
      const isFromPowershell = utils.isPathAccessible(fromPowershellPath)
      const isFromNpm = utils.isPathAccessible(fromNpmPath)

      // Found in...
      // Powershell: -> return powershell path
      // npm:        -> return npm path
      // nowhere:    -> return powershell path
      if (isFromPowershell) {
        return {
          path: fromPowershell,
          message: strings.npmFoundIn(fromPowershell, fromNpm, fromPowershell)
        }
      } else if (isFromNpm) {
        return {
          path: fromNpm,
          message: strings.npmFoundIn(fromPowershell, fromNpm, fromNpm)
        }
      } else {
        return {
          path: fromPowershell,
          message: strings.npmNotFoundGuessing(fromPowershell, fromNpm, fromPowershell)
        }
      }
    })
}
function _getPath () {
  return Promise.all([_getPathFromPowerShell(), _getPathFromNpm()])
    .then((results) => {
      const fromNpm = results[1] || ''
      const fromPowershell = results[0] || ''

      // Quickly check if there's an npm folder in there
      const fromPowershellPath = path.join(fromPowershell, 'node_modules', 'npm')
      const fromNpmPath = path.join(fromNpm, 'node_modules', 'npm')
      const isFromPowershell = utils.isPathAccessible(fromPowershellPath)
      const isFromNpm = utils.isPathAccessible(fromNpmPath)

      // Found in...
      // Powershell: -> return powershell path
      // npm:        -> return npm path
      // nowhere:    -> return powershell path
      if (isFromPowershell) {
        return {
          path: fromPowershell,
          message: strings.npmFoundIn(fromPowershell, fromNpm, fromPowershell)
        }
      } else if (isFromNpm) {
        return {
          path: fromNpm,
          message: strings.npmFoundIn(fromPowershell, fromNpm, fromNpm)
        }
      } else {
        return {
          path: fromPowershell,
          message: strings.npmNotFoundGuessing(fromPowershell, fromNpm, fromPowershell)
        }
      }
    })
}
function _getPath ( ) { return Promise . all ( [ _getPathFromPowerShell ( ) , _getPathFromNpm ( ) ] ) . then ( ( results ) => { const fromNpm = results [ 1 ] || '' const fromPowershell = results [ 0 ] || '' // Quickly check if there's an npm folder in there const fromPowershellPath = path . join ( fromPowershell , 'node_modules' , 'npm' ) const fromNpmPath = path . join ( fromNpm , 'node_modules' , 'npm' ) const isFromPowershell = utils . isPathAccessible ( fromPowershellPath ) const isFromNpm = utils . isPathAccessible ( fromNpmPath ) // Found in... // Powershell: -> return powershell path // npm:        -> return npm path // nowhere:    -> return powershell path if ( isFromPowershell ) { return { path : fromPowershell , message : strings . npmFoundIn ( fromPowershell , fromNpm , fromPowershell ) } } else if ( isFromNpm ) { return { path : fromNpm , message : strings . npmFoundIn ( fromPowershell , fromNpm , fromNpm ) } } else { return { path : fromPowershell , message : strings . npmNotFoundGuessing ( fromPowershell , fromNpm , fromPowershell ) } } } ) }
Attempts to get the current installation location of npm by looking up the global prefix.
Prefer PowerShell, be falls back to npm's opinion

@return {Promise.<string>} - NodeJS installation path
Attempts to get the current installation location of npm by looking up the global prefix . Prefer PowerShell be falls back to npm s opinion