Skip to content

Commit

Permalink
fix Windows support for installing node packages
Browse files Browse the repository at this point in the history
  • Loading branch information
atanas-dev committed Oct 25, 2018
1 parent 1c13587 commit b1b2595
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/NodePackageManagers/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ public function uninstall( $directory, OutputInterface $output, $package, $dev =
* @return NodePackageManagerInterface
*/
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 = 'which ' . $manager;
$command = $is_windows ? 'where ' . escapeshellarg( $manager ) : 'which ' . escapeshellarg( $manager );

try {
$output = App::execute( $command );
Expand Down

0 comments on commit b1b2595

Please sign in to comment.