title: Best way to set up a node.js web project in a closed environment
body: <p>We build a web application and our project uses various npm packages for development, testing and run-time.</p>
  
  <p>The project is built as part of a large project in TFS. TFS runs ant to build the project. Our build.xml first runs <code>npm install</code>, then transpiles and minifies the TypeScript and Sass files (using Grunt tasks) and then builds the final war fie.</p>
  
  <p>This all works OK, but our TFS is not allowed to access the Internet during the build, only our local network. Therefore, we have all the npm libraries we use copied to a file server in our network, and our package.json dependencies point to paths on that file server.</p>
  
  <p>Does this seems like a reasonable solution?</p>
  
  <p>The problem we have is that the npm install takes about 10 minutes to get all the >50 packages we use (which includes karma, grunt, sass, tslint, etc. – total is 170MB).</p>
  
  <p>We are now looking for way to reduce the TFS build time. One option is to but the node_modules in our source control and skip the <code>npm install</code> step, but is seems wrong to put third-party code in our source control.
  I’d love to hear other ideas to handle this and have shorter build time.</p>
  
  <p>Note that on developers machine the project builds in no time, as all packages are already installed, but TFS builds start by getting a clean environment from source control, so nothing is installed.</p>