[英]Getting EISDIR error from NodeJS when attempting to start app via Expo (React Native)
I'm getting the old 'directory is not a file' error with Node, and the output does not make it clear what exactly it's trying to parse.我在 Node 上遇到了旧的“目录不是文件”错误,并且 output 并没有明确说明它到底要解析什么。 I've tried putting logging in and everything to find the issue, and even created a brand new project but the issue persists.
我已经尝试过登录和一切以找到问题,甚至创建了一个全新的项目,但问题仍然存在。 Can anyone shed any light on this?
任何人都可以对此有所了解吗?
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>)
The problem turned out to be that some of the versions of modules that I installed using npm were not compatible with expo.问题原来是我使用npm安装的一些模块版本与expo不兼容。 These were indicated earlier than the error in the output for the 'expo start' command.
这些早于“expo start”命令的 output 中的错误指示。 Because these were info logs, I didn't pay enough attention to them.
因为这些是信息日志,所以我没有给予足够的重视。 However, after several hours I decided to fix them and it fixed my problem.
然而,几个小时后,我决定修复它们,它解决了我的问题。
The fix was to follow each individual package named in the output and run 'expo install '.修复方法是跟踪 output 中命名的每个单独的 package 并运行“expo install”。
Make sure the entryPoint
key in your app.config.js
or app.json
file is correctly set.确保
app.config.js
或app.json
文件中的entryPoint
键设置正确。
I had an intermittent error very similar to this and it was related to a bug with remote debugging.我遇到了一个与此非常相似的间歇性错误,它与远程调试的错误有关。
Turning off "Debug Remote JS" in the Expo Go app shake-to-show developer menu avoided this issue for me (logs and errors still show in the Metro console).在 Expo Go 应用程序摇动显示开发人员菜单中关闭“调试远程 JS”为我避免了这个问题(日志和错误仍然显示在 Metro 控制台中)。
Here's the exact error message I was getting (and sometimes the app would just fail silently without any error).这是我得到的确切错误消息(有时应用程序会默默地失败而没有任何错误)。 It's almost identical to the error in the question with a few different line numbers (maybe from different versions).
它几乎与问题中的错误相同,有几个不同的行号(可能来自不同的版本)。
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
As for "why", there's some related discussion on this expo forum thread which in turn links to this React Native bug (claimed to be fixed in Expo CLI 4.13.1
but many users reporting similar issues in recent versions).至于“为什么”,在这个 expo 论坛帖子上有一些相关的讨论,该帖子又链接到这个 React Native 错误(声称在 Expo CLI
4.13.1
中修复,但许多用户在最近的版本中报告了类似的问题)。
It might be related to the reported issues with Reanimated 2 and Expo's remote debugging (see this reanimated issue and the warning note in Expo's documentation ) for Reanimated.它可能与 Reanimated 2 的报告问题和 Expo 的远程调试有关(请参阅此 reanimated 问题和Expo 文档中的警告说明)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.