50

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?

9 Answers 9

103

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

4
  • 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
    Commented Jul 7, 2021 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
    Commented Aug 25, 2021 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. Commented Oct 18, 2021 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
    Commented Jul 1, 2022 at 18:10
76

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

5
  • 1
    if this solution wont working instead of #2 close the project then open it again after #1
    – noshad b.e
    Commented May 16, 2021 at 14:39
  • 2
    note that you might loose some customized settings when you delete .idea.
    – kca
    Commented May 31, 2021 at 9:53
  • 2
    This did not work for me. On PhpStorm version 2021.1.1
    – mpemburn
    Commented Apr 21, 2022 at 20:15
  • This will delete a lot of potentially important stuff like unit test settings.
    – aabreu
    Commented Aug 30, 2022 at 11:55
  • Scroll a little below and check out the solution which works without any invalidation: stackoverflow.com/a/65644645/1101589
    – Yehor
    Commented Jan 12, 2023 at 7:53
55

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.

6
  • Just had this happen today. Exit PhpStorm and restart. Your missing project view should now show up. If not, follow the steps above. Commented Jul 2, 2021 at 16:27
  • 11
    Thanks for this, step 1 is very important.
    – electrode
    Commented Jul 27, 2021 at 13:23
  • 1
    this worked for me using Webstorm. The trick seems like deleting that .idea file while the IDE is closed /shrug Commented Aug 11, 2021 at 19:15
  • @ConnerSmith yea it would seem so.
    – Macdonald
    Commented Aug 12, 2021 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
    Commented Jan 11, 2022 at 21:43
15

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

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

3
  • 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
    Commented Aug 9, 2021 at 15:17
  • This did the trick for me. The directory list was empty. Needed to select the project folder as "Content root". Commented Aug 23, 2022 at 12:44
  • Thank you, it helped even without restarting or invalidation. It happened for me the second time and your answer helped!
    – Yehor
    Commented Jan 12, 2023 at 7:48
2

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.
2

I had selected this option by mistake

enter image description here

1
  • 1
    For real, thank you for posting this.
    – Noah Heck
    Commented Oct 14, 2023 at 20:36
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.

1
  • 1
    Yes works. But beware: your deployment settings and other stuff can be lost.
    – Pete
    Commented May 5, 2022 at 8:37
-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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.