【问题标题】:Getting EISDIR error from NodeJS when attempting to start app via Expo (React Native)尝试通过 Expo(React Native)启动应用程序时从 NodeJS 获取 EISDIR 错误
【发布时间】:2021-03-14 19:11:51
【问题描述】:

我在 Node 上遇到了旧的“目录不是文件”错误,并且输出并没有清楚地说明它到底要解析什么。我已经尝试过登录和一切以找到问题,甚至创建了一个全新的项目,但问题仍然存在。任何人都可以对此有所了解吗?

Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:592:3)
at tryReadSync (fs.js:366:20)
at Object.readFileSync (fs.js:403:19)
at UnableToResolveError.buildCodeFrameMessage (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:304:17)
at new UnableToResolveError (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph.js:353:43)
at C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\lib\transformHelpers.js:271:42
at C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\Server.js:1098:37
at Generator.next (<anonymous>)

【问题讨论】:

    标签: javascript node.js react-native expo


    【解决方案1】:

    问题原来是我使用 npm 安装的一些模块版本与 expo 不兼容。这些指示早于“expo start”命令的输出中的错误。因为这些是信息日志,所以我没有给予足够的重视。然而,几个小时后,我决定修复它们并解决了我的问题。

    修复方法是跟踪输出中命名的每个单独的包并运行“expo install”。

    【讨论】:

      【解决方案2】:

      确保您的app.config.js 或app.json 文件中的entryPoint 键设置正确。

      【讨论】:

        【解决方案3】:

        我遇到了一个与此非常相似的间歇性错误,它与远程调试的错误有关。

        在 Expo Go 应用程序摇动显示开发人员菜单中关闭“调试远程 JS” 为我避免了这个问题(日志和错误仍显示在 Metro 控制台中)。


        这是我得到的确切错误消息(有时应用程序会静默失败而没有任何错误)。它几乎与问题中的错误相同,但有几个不同的行号(可能来自不同的版本)。

        Error: EISDIR: illegal operation on a directory, read
            at Object.readSync (node:fs:721:3)
            at tryReadSync (node:fs:431:20)
            at Object.readFileSync (node:fs:477:19)
            at UnableToResolveError.buildCodeFrameMessage 
        

        至于“为什么”,this expo forum thread 上有一些相关讨论,而这些讨论又链接到this React Native bug(声称已在 Expo CLI 4.13.1 中修复,但许多用户在最近的版本中报告了类似问题)。

        这可能与 Reanimated 2 的报告问题和 Expo 的 Reanimated 远程调试问题(请参阅 this reanimated issue 和 the warning note in Expo's documentation)有关。

        【讨论】:

          猜你喜欢
          • 2019-08-26
          • 1970-01-01
          • 2020-05-29
          • 1970-01-01
          • 2021-09-12
          • 1970-01-01
          • 2021-07-04
          • 2021-11-13
          • 2018-04-07
          相关资源
          最近更新 更多