46

After I had installed PhpStorm and created a project from an existing source files, The project pane is not showing any file from the directory. So how can we solve the problem?

Muhannad A.Alhariri
  • 3,702
  • 4
  • 30
  • 46

9 Answers9

91

In case both above solutions do not work, try this following approach:

  1. cd to your projects .idea Folder

  2. Check if there is a file called project_name.iml. If this is not the case create it and paste the following content to it

    <?xml version="1.0" encoding="UTF-8"?>
    <module type="WEB_MODULE" version="4">
      <component name="NewModuleRootManager">
        <content url="file://$MODULE_DIR$"></content>
      </component>
    </module>
    
  3. Then check if there is a file called modules.xml. If this is not the case create it and paste the following content to it (which targets to your previously created project_name.iml)

    <?xml version="1.0" encoding="UTF-8"?>
    <project version="4">
      <component name="ProjectModuleManager">
        <modules>
          <module fileurl="file://$PROJECT_DIR$/.idea/project_name.iml" filepath="$PROJECT_DIR$/.idea/project_name.iml" />
        </modules>
      </component>
    </project>
    
  4. Restart PhpStorm

Mustafa Yousef
  • 1,326
  • 12
  • 13
  • 3
    The accepted solution didn't work for me. This one yes, just after step 3. No need to restart. But I did it completely. Thanks bro – Spartacvs1 Jul 07 '21 at 13:09
  • 2
    Thank you for this!! I had no interest in deleting my `.idea` folder and losing all my settings after a colleague unintentionally committed his .idea folder and overwrote stuff in mine when I checked it out. This got things working for me again where invalidating the cache and other solutions did not. – Chris Aug 25 '21 at 11:42
  • 1
    This helped restore my "Always Select Opened File" option in the Project Files pane. Apparently "Always Select Opened File" only works on project files, and my corrupted .idea file saw all my project files as non-project. – Kerry Johnson Oct 18 '21 at 22:35
  • 2
    Re-linking the modules.xml file with my newly named project fixed the problem immediately. A note for anyone who might have issues, project_name.iml is a placeholder. So if your project is named MyAwesomeProject, look for MyAwesomeProject.iml and then re-link in modules.xml. – Ian Jul 01 '22 at 18:10
66

After investigation on the issue, I got the solution as follow:

  1. Remove .idea directory from your root project directory
  2. Invalidate and restart your IDE , FILE -> Invalidate cache /Restart -> then click on Invalidate cache and restart
  3. You are done :)

Here is the source

https://intellij-support.jetbrains.com/hc/en-us/community/posts/207066915-Project-view-not-showing-directories

Muhannad A.Alhariri
  • 3,702
  • 4
  • 30
  • 46
50

I was able to resolve this in PhpStorm 2021.2.4 with the following steps:

  • Exit PhpStorm
  • Remove the existing .idea folder (like so rm -rf .idea)
  • Restart PhpStorm
  • click File > Open to select your project directory

Everything should be fine now.

Macdonald
  • 880
  • 7
  • 21
  • Just had this happen today. Exit PhpStorm and restart. Your missing project view should now show up. If not, follow the steps above. – Dan Morphis Jul 02 '21 at 16:27
  • 11
    Thanks for this, step 1 is very important. – electrode Jul 27 '21 at 13:23
  • 1
    this worked for me using Webstorm. The trick seems like deleting that .idea file while the IDE is closed /shrug – Conner Smith Aug 11 '21 at 19:15
  • @ConnerSmith yea it would seem so. – Macdonald Aug 12 '21 at 14:20
  • 1
    This should be the answer for all jetbrains IDE's! Does anyone actually know what is causing this glitch? I remember this happening for the whole 6 years I'm using jetbrains products – Kelvijn Jan 11 '22 at 21:43
  • Thanks, This helped me! :) Note:- You will lose some of the customized settings when you remove the existing .idea directory. – Dula Sep 29 '22 at 01:47
9

The accepted answer did not work me. What worked for me was

File > Repair IDE...

And you'll be prompted in the lower right side corner with some alerts that have suggestions. Click on those until its fixed.

enter image description here

No Sssweat
  • 358
  • 1
  • 6
  • 24
4

Go to the menu File -> Settings -> Directories and then delete the current directory and add a new directory with the root of your project that worked for me.

Ingresas al menú File -> Settings -> Directories y luego eliminas el directorio actual y agregar un nuevo directorio con la raíz de tu proyecto eso funciono para mi.

enter image description here

  • 1
    This is what worked for me. Initially the Directories window was blank. After following @ Mustafa Yousef 's steps above (which didn't in themselves fix it), and re-starting PhpStorm, then I was able to do this. Only 5 hours lost to this ... ! – forrestedw Aug 09 '21 at 15:17
  • This did the trick for me. The directory list was empty. Needed to select the project folder as "Content root". – Bence Szalai Aug 23 '22 at 12:44
  • Thank you, it helped even without restarting or invalidation. It happened for me the second time and your answer helped! – Yehor Jan 12 '23 at 07:48
1

For my version of Phpstorm the solution was to go to:

  1. File > Close Project
  2. Click on the gear icon of the project in question > Remove from Recent Projects
  3. Click New Project > Select the folder path > Click on Create button > Click the button Create from Existing Sources.
Sotmir Laci
  • 84
  • 1
  • 6
1

I tried the above solution and was not successful. The following, however did work.

  1. Close all projects.
  2. On the list of project, select yours, right click, and chose "Remove from Recent Projects".
  3. Click "New Project" and choose your project's directory and click "Create"
  4. In the "Directory Is Not Empty" dialog, click "Create from Existing Source".

When I opened the "new" project, everything was there including the Local History—thank the Gods!

Ref: PhpStorm version 2021.1.1 on Mac Catalina.

mpemburn
  • 2,776
  • 1
  • 35
  • 41
0

I had selected this option by mistake

enter image description here

Technolo Jesus
  • 147
  • 2
  • 9
-3

I fixed this by resetting my IDE default settings

File -> Manage IDE settings -> Restore default settings

Note that this will remove all your plugins and configurations

Dharman
  • 30,962
  • 25
  • 85
  • 135
Leonel Kahameni
  • 793
  • 8
  • 10