Search code examples
node.jsvisual-studiotfsnpmtfsbuild

How can I check `bin/` directories under `node_modules/` into TFS?


I have a Team Foundation Build server behind a firewall, and I would like to check in a node_modules/ directory (powering both a Browserify client app and Node server app) associated with a project so that all of the files and dependencies needed to deploy a build are available without fetching anything.

Checking node_modules/ in to TFS seemed to work at first, except that the bin/ directories appearing in around 20 of my NPM dependencies were not checked in. bin/ does not appear in my .tfignore (or anywhere else I know of that could be preventing the check in).

These bin/ directories don't appear in the included/excluded changes in Team Explorer, at all. It's possible to locate one of these folders in Windows Explorer and add it with the TFS context menu, but doing that for all of the dependencies would be horrifically tedious and error prone.

How can I persuade TFS to detect changes in these folders? Is there some other configuration affecting included/excluded changes that I'm not aware of?


Solution

  • It is not recommended to upload "bin" folder or "node_modules" folder into Version Control. But if you do want to do this, following the steps below:

    1. Go to "C:\Users\youraccount\AppData\Local\Microsoft\Team Foundation\x.0\Configuration\VersionControl" folder and open "LocalItemExclusions.config" file. (There may several folders named like 1.0, 2.0, 3.0, you need to make sure open the folder your VS current use.)

    2. Delete the lines like following and save the file:

      <Exclusion>bin</Exclusion>
      <Exclusion>*.dll</Exclusion>
    
    1. Close Visual Studio.
    2. Delete "node_modules" folder.
    3. Restart Visual Studio.
    4. Run "npm install" command to reinstall the node modules.
    5. Check "Pending Changes", files in "bin" folder should be listed in "Excluded Changes" section.