开玩笑 - 观看抛出错误:eacces:root拥有的目录的权限

发布于 2025-02-01 08:19:22 字数 655 浏览 4 评论 0原文

问题

当我运行jest -watch时,即使我在目录中使用watchpathignorepatterns目录:

Error: EACCES: permission denied, scandir '/path/to/repo/.pgdata'
  • .pgdata /是用于PostgreSQL的Docker卷的目录。
  • 该目录由root拥有。

我尝试使用WatchPathignorePatterns尝试的解决方案

在我的Jest Config:

watchPathIgnorePatterns: ['<rootDir>/\\.pgdata/'],

我尝试了modulepathignorepatternstastpathignorepatterns的类似模式。

我还尝试使用.pgdata的所有者使用chown将其设置为我的用户,但这需要更改Docker设置,我现在不想立即进行。

Problem

When I run jest --watch, I get a permission denied error on a directory in my repository, even if I use watchPathIgnorePatterns for the directory:

Error: EACCES: permission denied, scandir '/path/to/repo/.pgdata'
  • .pgdata/ is a directory used as a Docker volume for postgresql.
  • The directory is owned by root.

Solutions tried

I tried using watchPathIgnorePatterns in my jest config:

watchPathIgnorePatterns: ['<rootDir>/\\.pgdata/'],

I tried a similar pattern for modulePathIgnorePatterns and testPathIgnorePatterns.

I also tried setting the owner of .pgdata to my user with chown, but that required a change in the Docker setup that I don't want to make right now.

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

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

发布评论

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

评论(1

花海 2025-02-08 08:19:23

使用 roots> roots 配置属性解决了问题:

roots: ['<rootDir>/__tests__']

这告诉jest jest jest仅在搜索文件__测试__目录。

Note :我在__测试__中只有测试,而且我没有src/目录。如果我这样做的话,它可能还必须包括在文档中的示例中,


即使使用WatchPathignorePatterns,Jest Watcher仍然试图通过存储库中的所有目录运行。由于它遇到了一个目录,因此无法访问读取的目录,因此会引发错误(在Jest 28.1.0上测试)

此无关发行评论为开玩笑暗示了解决方案。

Using the roots config property fixed the problem:

roots: ['<rootDir>/__tests__']

This tells jest to only search for files in the __tests__ directory.

Note: I only have tests in __tests__, and I don't have a src/ directory. If I did, it would probably have to be included as well, as shown in the example in the documentation.


Even when using watchPathIgnorePatterns, the jest watcher still tries to run through all directories in the repository. Since it encounters a directory it does not have access to read from, it throws the error (tested on jest 28.1.0)

This unrelated issue comment for jest hinted at the solution.

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