0

We have a problem whereby Visual Studio inspects a node_modules folder and causes a compilation error. This is a known problem and the easiest fix is to mark the folder as hidden.

That's fine but when new machines clone the repo, the folder gets restored as a normal folder and causes some head scratching when it breaks with a completely unhelpful error.

Is there a way to add something to make this folder stay hidden on new clones?

Craig
  • 474
  • 7
  • 21
  • 1
    `/node_modules` probably isn't in your repo at all, I'd expect to see it in `.gitignore`. It's likely the NPM/Yarn install that adds that directory, not the git clone. – jonrsharpe Feb 25 '19 at 17:11
  • Correct, it isn't. It's restored later when we run gulp, but it would be great if we could have it as an empty folder or something in git with some way of marking it as hidden. Maybe we could look at making gulp hide it. – Craig Feb 25 '19 at 18:13
  • `git` doesn't preserve empty folders, and it doesn't preserve the level of metadata you're wanting anyway. You could add instructions in a readme, or a script for people to run when cloning, or maybe make hiding the folder a part of your build scripts – Mark Adelsberger Feb 25 '19 at 18:53
  • 1
    You can insert a dot file often named `.gitkeep` in an otherwise empty folder as a hack to allow git to add it. see https://stackoverflow.com/questions/7229885/what-are-the-differences-between-gitignore-and-gitkeep – Todd Feb 26 '19 at 02:32

0 Answers0