Skip to content

Instantly share code, notes, and snippets.

@nordineb
Last active March 22, 2018 13:51
Show Gist options
  • Save nordineb/104a4adb937986e40af7f1746756349b to your computer and use it in GitHub Desktop.
Save nordineb/104a4adb937986e40af7f1746756349b to your computer and use it in GitHub Desktop.
Run npm install in every folder that contains a package.json file

Run npm install in every folder that contains a package.json file

$originalLocation = Get-Location
$folders = Get-ChildItem $originalLocation -Directory -Recurse -Name `
            | Where {$_ -notlike "*node_modules*"} `
            | Where {$_ -notlike "*jspm_packages*"} `
            | where { test-path (join-path $_ "package.json") }

. npm set progress=false

foreach ($folder in $folders) {    
    cd $folder
    . npm install  
    cd $originalLocation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment