title: NPM preinstall script
body: <p>I am trying to run some policing script before any packages are installed. 
  For Example:</p>
  
  <pre><code>{
    "name": "pre-hook-check",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
      "preinstall": "echo preinstall",
      "postinstall": "echo postinstall"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
      "abc": "^0.6.1",
      "preact": "^8.2.5"
    }
  }
  </code></pre>
  
  <p>It seems the pre and post install script on above example only works when I do <code>npm install</code>, but I want that to run every time I try to install anything. </p>
  
  <p>For example: Let's say I want to write a script to check for the version of the package any time my team runs <code>npm install &lt;some package&gt;</code>. I want to check for the version of installing package and verify that it's version is above "1.0.0" else don't let them install.</p>
  
  <p>I was planning to write a preinstall script that goes</p>
  
  <p><code>npm info lodash version</code> </p>
  
  <p>and checks for the version of any package I am trying to install. If the version is not available, I plan to make it interactive and ask user's acknowledgement before install. </p>