Ignore node_modules in Webstorm when using navigation pop-up

Webstorm

Webstorm Problem Overview


Is it possible to ignore searching the node_modules folder when using WebStorm's navigation pop-up window (Command + Shift + N)?

This makes it really annoying when wanting to quickly navigate to, for example, the package.json file.

Webstorm Solutions


Solution 1 - Webstorm

To exclude the directory from being searched via navigation pop-up, pick node_modules directory in Project view, then from mouse context menu:

Mark Directory As -> Excluded

enter image description here

Directory could be restored via Preferences->Directories->Excluded Folders settings

Solution 2 - Webstorm

In Webstorm 8, you need to also visit Settings > JavaScript > Libraries and disable Node.js core modules and node_modules. The directory exclusion will then work as before.

Solution 3 - Webstorm

To exclude node_modules/ files from being searched in "Navigate | File..." popup and to avoid indexing node_modules/ folder, please perform these steps:

  1. Mark node_modules/ folder as excluded in Settings | Directories.

  2. Remove "<your project name> node_modules" library in Settings | Languages & Frameworks | JavaScript | Libraries.

Solution 4 - Webstorm

To exclude node_modules folder from all projects (only created after that change) you can add this folder to list of standard folders to ignore.

  1. Open PHPStorm, and close current project File > Close Project.

  2. On startup PHPStorm window click "Configure > Settings". enter image description here

  3. Then navigate to Build, Execution, Deployment > Deployment > Options.

  4. Now you can set node_modules or anyone else to exclude by default for all new projects. enter image description here

P.s. Closing the current project is very important. If you do this settings with active project, this will affect only current project.

Solution 5 - Webstorm

I'm not sure why, but I saw lots of files with "spec" on Ctrl+Shift+n (I can't publish images, sorry :( )

I saw on the contextual menu over the node_modules: "Mark directory as": "excluded", "test sources root", "resources root"

I went to settings > directories, and I saw the node_modules with red color and can't change it, but, on the left there is list without header (?), I'm not sure if it is the exclude list, but, there is an X, I pushed on it, and restarted the IDE and it works!

If I see the contextual again, I see: "Mark directory as": "not exclude" and "test sources root". And in settings > directories I do not see on the lists, but red color on the folder node_modules (weird), I think it is so particular for this folder.

Solution 6 - Webstorm

While webstorm tries to keep indexing everything inside your project - while if its a node project - the indexing takes forever, the better ways to exclude the node folder from indexing as below.

Select folder -- Settings|Directories -> Use Exclude - button on folder

Solution 7 - Webstorm

  1. Exclude the directory: Mark the directory itself as excluded (Right-Click -> Mark Directory As -> Excluded). It might then already disappear.
  2. Hide excluded files: Tick the project pane option (under the Gear-Wheel symbol) and un-tick Show Excluded Files to hide excluded directories

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questioninreflection7View Question on Stackoverflow
Solution 1 - WebstormAndrei KarpushonakView Answer on Stackoverflow
Solution 2 - WebstormAram KocharyanView Answer on Stackoverflow
Solution 3 - WebstormSergey.SimonchikView Answer on Stackoverflow
Solution 4 - WebstormNiklanView Answer on Stackoverflow
Solution 5 - WebstormCrystianView Answer on Stackoverflow
Solution 6 - WebstormPravin BansalView Answer on Stackoverflow
Solution 7 - WebstormWebBrotherView Answer on Stackoverflow