Atom exclude node_modules folder from search
Solution 1
Steps
- Launch atom
- From the menu: edit > preferences (atom > prefernces on Mac)
- From the side menu, click the button "Open Config Folder"
Now a new atom IDE should open.
- Open the file "config.cson"
- Add
ignoredNames: ["node_modules"]
undercore
Example of a config.cson
"*":
core:
ignoredNames: [
".git"
"node_modules"
]
editor: {}
minimap:
plugins:
"highlight-selected": true
"highlight-selectedDecorationsZIndex": 0
welcome:
showOnStartup: false
Hope this helps
Solution 2
In the "File/directory pattern" field of the search use an exclamation mark followed by the name of the directory you want to ignore:
Solution 3
If your .gitignore file sits higher in the directory than where you are performing a Search in Directory your node_modules will not be excluded from Atom's search.
For that reason I recommend adding node_modules to the Ignored Names list in the Core Settings.
Solution 4
The .gitignore file should be enough for Atom to exclude the folder, as long as you have the ignore "exclude VCS ignored paths" option checked.
You should also append a "/" after node_modules
node_modules/
Solution 5
For new versions of Atom (I am using 1.28.2 on Windows) I accessed config.cson via File > Config...
Then, as mentioned in this previous answer, ignoredNames: ["node_modules"]
must be added under the core
section:
"*":
core:
telemetryConsent: "no"
themes: [
"one-light-ui"
"one-light-syntax"
]
ignoredNames: ["node_modules"]
Ville Miekk-oja
Updated on July 20, 2022Comments
-
Ville Miekk-oja almost 2 years
How to exclude node_modules folder from Atom searches "Find in project" after you have put node_modules inside your .gitignore file? Does atom require that the project actually has a git repository, or should the .gitignore be enough for Atom to exclude the folder?
My .gitignore looks like this:
.DS_STORE *.log node_modules dist coverage
-
Ville Miekk-oja almost 8 yearsWorks on Windows, but not on Ubuntu through Virtualbox. I did what you suggested, and didn't work. It still searches from the whole project
-
goliatone over 7 yearsis there a way to have node_modules show in your side bar but not on your searches?
-
Matt Dell over 7 yearsIf you're banging your head with the above not working, ensure your
.gitignore
file is in the root of your repository and not within say/web/.gitignore
. Took me some time to realize that it only looks at/.gitignore/
-
Johan Degrieck about 7 yearsThanks Rodrigo, seperate with a comma to exclude multiple folders f.e. !node_modules, !bower_components
-
Marian07 over 6 yearsThis way,
node_modules
disappears from the tree-view. -
sager almost 6 yearsNo,
node_modules
will stay with this solution. This should be the accepted answer, for sure. -
Mircea over 5 yearsOne problem with this approach is when one has sources in a "lib" subfolder. I agree it is not a good practice, but it happens (e.g. python + nodejs project)
-
massic80 over 5 yearsA tiny detail: in my Windows version of Atom, the Open Config Folder button is in File -> Settings
-
Altin about 3 years@sager yes, it disappears from tree view. And it's fkn annoying!