protected function getNodePackageManager() {
		$is_windows = strtolower( substr( PHP_OS, 0, 3 ) ) === 'win';
		$node_package_managers = [
			'yarn' => Yarn::class,
			'npm' => Npm::class,
		];

		foreach ( $node_package_managers as $manager => $class ) {
			$command = $is_windows ? 'where ' . escapeshellarg( $manager ) : 'which ' . escapeshellarg( $manager );

			try {
				$output = App::execute( $command );
			} catch ( ProcessFailedException $e ) {
				continue;
			}

			if ( ! trim( $output ) ) {
				continue;
			}

			return new $class();
		}

		throw new RuntimeException( 'Could not find a node package manager. Please check if npm is added to your PATH.' );
	}