---
title: "Program Dependency Management With node.js"
description: "Lately was working with a few PRs for The Yeoman project and tried to hack through a shelljs script to audit the OS before."
url: "https://h3manth.com/scribe/program-dependency-management-nodejs/"
canonical_url: "https://h3manth.com/scribe/program-dependency-management-nodejs/"
markdown_url: "https://h3manth.com/scribe/blog/program-dependency-management-nodejs.md"
publishDate: "2012-09-15T00:00:00.000Z"
author: "Hemanth HM"
category: "javascript"
tags: ["ruby","nodejs","git","bash"]
word_count: 174
reading_time_minutes: 1
x_markdown_tokens: 392
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Program Dependency Management With node.js

> Lately was working with a few PRs for The Yeoman project and tried to hack through a shelljs script to audit the OS before.

Lately was working with a few PRs for The Yeoman project and tried to hack through a shelljs script to audit the OS before installation.

P.S : ` npm install shelljs ` as this is the dependency for this dependency management script :D

**The code :**

require('shelljs/global'); var os = require('os'); var sys = require('sys');

var os_type = os.type(); var installed = []; var not_installed = [];

var deps = { curl : '', git : '', ruby : '1.8', node : '0.8', compass : '0.12', gem : '', phantomjs : '', jpegtran : '', optipng : '', yeoman : '', clang : '', brew : '' };

if(os_type == "Linux") { //This is Linux so remove Mac deps. delete deps['clang']; delete deps['brew']; }

for(var dep in deps) { if (!which(dep)) {
    
    
    not_installed.push(dep);
    

} else{
    
    
    if(deps[dep]){
      var version = exec(dep +' -v', {silent:true}).output;
      console.log(version);
      console.log(deps[dep]);
      if(version.search(deps[dep]) == -1){
        not_installed.push(dep); // Installed, but version mismatch.
      }
    }
    else{
      installed.push(dep);
    }
    

}  
}

console.log(installed); console.log(not_installed);

Do let me know your thoughts on the same, happy hacking!
