Building ionic angular app fails when built from teamcity but succeeds every where else

We were finally able to find the issue by debugging into fs.js where we would get the following error. This error was captured at a lower level and we only got the error in my question without debugging into fs.js.

EISDIR: illegal operation on a directory

The issue we ran into was because our D: drive was made using an application called ImDisk. The ImDisk utility apparently produces a drive which does not match some of the conditions fs.js checks to see if it can interact with the directory. We switched to using aim_ll.exe because of this comment on this github issue which has many people reporting the issue with ImDisk but not a lot of information on what ImDisk does differently than aim_ll.exe.