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
In case both above solutions do not work, try this following approach:
cd
to your projects.idea
FolderCheck 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>
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 createdproject_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>
Restart PhpStorm
-
3The 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 Commented Jul 7, 2021 at 13:09
-
2Thank 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.– ChrisCommented Aug 25, 2021 at 11:42 -
1This 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
-
2Re-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.– IanCommented Jul 1, 2022 at 18:10
After investigation on the issue, I got the solution as follow:
- Remove .idea directory from your root project directory
- Invalidate and restart your IDE , FILE -> Invalidate cache /Restart -> then click on Invalidate cache and restart
- You are done :)
Here is the source
-
1if this solution wont working instead of #2 close the project then open it again after #1 Commented May 16, 2021 at 14:39
-
2note that you might loose some customized settings when you delete .idea.– kcaCommented May 31, 2021 at 9:53
-
2
-
This will delete a lot of potentially important stuff like unit test settings.– aabreuCommented 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– YehorCommented Jan 12, 2023 at 7:53
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.
-
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
-
1this 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
-
-
1This 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– KelvijnCommented Jan 11, 2022 at 21:43
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.
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.
-
1This 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 ... ! 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!– YehorCommented Jan 12, 2023 at 7:48
For my version of Phpstorm the solution was to go to:
- File > Close Project
- Click on the gear icon of the project in question > Remove from Recent Projects
- Click New Project > Select the folder path > Click on Create button > Click the button Create from Existing Sources.
-
1
I tried the above solution and was not successful. The following, however did work.
- Close all projects.
- On the list of project, select yours, right click, and chose "Remove from Recent Projects".
- Click "New Project" and choose your project's directory and click "Create"
- 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.
-
1Yes works. But beware: your deployment settings and other stuff can be lost.– PeteCommented May 5, 2022 at 8:37
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