how can I filter out unwanted search results in Alfred (ie node_modules folder, caches)

Been a user of Alfred for a long time, however whenever I search anything I get a lot of FUD results due to alfred also indexing all my web project node_modules directories.

Is there any way to path-match and exclude all results from within a /node_modules/ directory? This would greatly improve the utility of the search.


Go to Preferences -> Spotlight -> Privacy (TAB) Then add the folders you want to exclude to that list.


You can also add alfred:ignore to the spotlight comments of the folder that you want exclude, in your case the node_modules folder.


This issue has been in discussion on the Alfred Forum since 2013 and unfortunately the answer is that Alfred can't really omit "node_modules" without you tagging all folders with the alfred:ignore tag. This would of course involve yet another script so it's overkill.

There is an alternative solution though: switch to yarn 2 and this issue with Alfred will implicitly go away! They built a new system-wide caching mechanism which avoids installing "node_modules" in every node project.

https://github.com/yarnpkg/berry