Webstorm 项目窗格中缺少文件夹

发布于 2025-01-05 12:35:48 字数 247 浏览 0 评论 0原文

我在WebStorm中构建了一个项目,然后将该项目提交到GitHub。

当我重新启动计算机并重新启动 WebStorm(和项目)时,我在项目窗格中只能看到根文件,并且没有任何文件夹(是的,文件夹在那里)

请参阅下图以供参考。

有谁知道如何让这些文件夹重新出现在 Webstorm 的项目窗格中?

在此处输入图像描述

I've built a project in WebStorm and then submitted the project to GitHub.

When I rebooted the computer and relaunched WebStorm (and the project), all I can see in the project pane is the root files, and none of the folders (yes the folders are there)

See the image below for reference.

Does anyone know how I can get those folders to re-appear in the project pane of Webstorm?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

回眸一笑 2025-01-12 12:35:49

在项目根目录中找到 .idea/modules.xml
确保这些行正确:

<modules>
  <module fileurl="file://$PROJECT_DIR$/.idea/NameOfYourProject.iml" filepath="$PROJECT_DIR$/.idea/NameOfYourProject.iml" />
</modules>

将 NameOfYourProject.iml 替换为您的项目名称。

然后,确保文件 .idea/NameOfYourProject.iml 存在,如果不存在,则创建它并将其放入其中:

<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
  <component name="NewModuleRootManager">
    <content url="file://$MODULE_DIR$" />
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="module-library">
      <library name="PHP">
        <CLASSES>
          <root url="file://$MODULE_DIR$/../../php/PEAR" />
        </CLASSES>
        <SOURCES />
      </library>
    </orderEntry>
  </component>
</module>

Find the .idea/modules.xml in your project root
make sure that these lines are correct :

<modules>
  <module fileurl="file://$PROJECT_DIR$/.idea/NameOfYourProject.iml" filepath="$PROJECT_DIR$/.idea/NameOfYourProject.iml" />
</modules>

Replace NameOfYourProject.iml with the name of your project.

Then, make sure that the file .idea/NameOfYourProject.iml exists, if not , create it and put this in it :

<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
  <component name="NewModuleRootManager">
    <content url="file://$MODULE_DIR$" />
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="module-library">
      <library name="PHP">
        <CLASSES>
          <root url="file://$MODULE_DIR$/../../php/PEAR" />
        </CLASSES>
        <SOURCES />
      </library>
    </orderEntry>
  </component>
</module>
绅刃 2025-01-12 12:35:49

您不需要删除整个 .idea 文件夹并重新配置整个项目,只需

  1. 删除 .idea/modules.xml
  2. 重新启动 IDE,您的文件夹就会再次出现!

You do not need to delete whole .idea folder and reconfigure your whole project, just

  1. delete the .idea/modules.xml
  2. restart the IDE and your folders are there again!
明月松间行 2025-01-12 12:35:49

我遇到了同样的问题并通过使缓存失效来解决它。
该选项位于“文件”>“使缓存无效/重新启动。
在提示中单击“无效并重新启动”。

注意:执行此操作之前需要打开相关项目。

I ran into the same issue and resolved it by invalidating the cache.
The option is under File > Invalidate Caches/Restart.
On the prompt click Invalidate and restart.

Note: The project in concern needs to be open before you do this.

醉酒的小男人 2025-01-12 12:35:49

我时常看到这一点。我使用 Git,并将 .gitignore 文件设置为 推荐,具体来说:

.idea/workspace.xml
.idea/tasks.xml
.idea/*.iml

我有时在克隆存储库后会看到这一点,当试图找出原因时,我遇到了这篇文章并阅读已接受的答案。

我删除了modules.xml文件,重新打开WebStorm(2016.2.4),就解决了。我查看了新的 modules.xml ,发现它的内容与以前完全相同,但我的 .iml 文件更大。

因此,这似乎是 .iml 文件中的损坏,而不是 modules.xml 中的损坏。我假设删除 modules.xml 会触发 .iml 文件的重建。不确定这是否对任何人有帮助,但我想我会提供额外的见解。

I see this from time to time. I use Git, and I have my .gitignore file set up as recommended, specifically:

.idea/workspace.xml
.idea/tasks.xml
.idea/*.iml

I sometimes see this after cloning the repository, and when trying to figure out why, I came across this post and read the accepted answer.

I deleted the modules.xml file and reopened WebStorm (2016.2.4), and it was resolved. I looked at the new modules.xml and found that its contents were exactly the same as before, but my <projectName>.iml file was bigger.

So it seems to be a corruption in the .iml file, not modules.xml. I assume that deleting modules.xml triggers a rebuild of the .iml file. Not sure if this helps anyone with anything, but thought I would offer the extra insight.

浅紫色的梦幻 2025-01-12 12:35:49

36楼解决了我的问题。在WebStorm 11中

有时会在WebStorm 9中发生。对我来说修复它的最简单方法:

  1. 关闭WebStorm;
  2. 在项目文件夹中删除 .idea/ (隐藏目录);
  3. 打开你的项目,享受吧:)

floor 36 solve my problem. in WebStrorm 11

It happens sometimes in WebStorm 9. The easiest way to fix it for me:

  1. close WebStorm;
  2. in project's folder remove .idea/ (hidden directory);
  3. open your project, enjoy:)
莫言歌 2025-01-12 12:35:49

尝试删除workspace.xml和watchertask.xml,然后重新启动IDE。您必须在所有文件夹中看到完整的源代码。

Try deleting workspace.xml and watchertask.xml then just restart the IDE. You must see your full source code in all folders there.

萌无敌 2025-01-12 12:35:49

最后我找到了罪魁祸首,它是来自 https://plugins.jetbrains.com/plugin/7961-team-foundation-server--version-control-integration/

我查看了system/log/idea. log 文件,发现每当我将新文件夹作为新项目打开并破坏内容根自动检测时,该插件都会产生 Null 异常通过 IDE,卸载后插件,所有文件夹都按其应有的方式显示。

您可能因为罪魁祸首插件而遇到此问题,并且在出现此问题之前禁用最近刚刚安装的插件可以解决此问题。检查日志文件并搜索ERROR

如果发现它是您正在积极使用且不愿意禁用的重要插件,则临时修复方法是打开设置->目录并单击< strong>添加内容根按钮添加项目的根文件夹,单击确定现在文件夹将显示,索引将显示开始,当然,每次打开新文件夹时都必须执行此操作作为新项目。

Finally I found the culprit, it was Team Foundation Server - Version Control Integration plugin from https://plugins.jetbrains.com/plugin/7961-team-foundation-server--version-control-integration/

I looked at the system/log/idea.log file and found that this plugin was producing Null exception whenever I open a new folder as a new project and breaks the content root auto detection by the IDE, and after I uninstalled this plugin, all folders show up as it should.

You might have this issue because of a culprit plugin, and disabling those which you have just installed recently just before this issue occurs, will resolve the issue. Check the log file and search for ERROR.

If it is found to be an important plugin you are actively using which you are not willing to disable, then a temporary fix is to open Settings->Directories and click Add content root button to add the root folder of your project, click Ok now folders will show up and indexing will begin, and of course you have to do this everytime you open a new folder as new project.

↙温凉少女 2025-01-12 12:35:48

它可能是由损坏的 .idea/modules.xml 项目文件引起的。您可以尝试手动修复它(从本地历史记录、版本控制或备份恢复)或从头开始创建新项目。

检查此问题以获取提示/解决方法。

It can be caused by the corrupted .idea/modules.xml project file. You can either try to fix it manually (restore from Local History, version control or backup) or create the new project from scratch.

Check this issue for the hints/workarounds.

你的心境我的脸 2025-01-12 12:35:48

在 WebStorm 9 中有时会发生这种情况。
对我来说最简单的修复方法是:

  1. 关闭WebStorm;
  2. 在项目文件夹中删除 .idea/ (隐藏目录);
  3. 打开你的项目,享受吧:)

It happens sometimes in WebStorm 9.
The easiest way to fix it for me:

  1. close WebStorm;
  2. in project's folder remove .idea/ (hidden directory);
  3. open your project, enjoy:)
苍风燃霜 2025-01-12 12:35:48

解决方案:


从现有源创建一个新项目

  1. File =>新=>项目
  2. 选择“空项目”
  3. 浏览到包含文件夹问题的项目位置
  4. 单击“创建”
  5. 在“目录不为空”对话框中选择“从现有源创建”

为什么采用此解决方案:


以 .idea 和 .idea 的各种组合进行编辑和删除XML 文件没有为我解决问题。因此就有了上面的解决方案。备份您的 .idea 目录,以防您想要保留项目自定义内容。这可能会覆盖它们。

结果:


我创建的所有各种文件夹现在都可见,并且该项目按预期工作。 .idea 目录现在已正确格式化,包含所有必要的文件。

Solution:


Creating a new project from existing sources

  1. File => New => Project
  2. Select "Empty Project"
  3. Browse to the location of your project with folder issues
  4. Click "Create"
  5. Select "Create from Existing Sources" in the "Directory Is Not Empty" dialog

Why this solution:


Editing and deleting in various combinations of .idea and XML files did not solve the issue for me. Hence the solution above. Back up your .idea directory in case you have project customizations you want to keep. This likely overwrites them.

Outcome:


All the various folders I had created were now visible and the project worked as expected. The .idea directory was now formatted correctly with all the necessary files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文