简体   繁体   English

React-native - ios - Enoent - 找不到这样的文件或目录

[英]React-native - ios - Enoent - No such file or directory found

I'm building an app in react-native for ios.我正在为 ios 构建一个 react-native 应用程序。 When attempting to build, xcode reports no errors and the simulator starts up.尝试构建时,xcode 不会报告任何错误并且模拟器会启动。 The app begins to load and I get a red error screen with the following info in the log:应用程序开始加载,我收到一个红色错误屏幕,日志中包含以下信息:

2017-03-20 19:22:40.523325 [APPNAME][69099:5420843] [] nw_host_stats_add_src recv too small, received 24, expected 28 2017-03-20 19:22:40.541 [fatal][tid:main] TransformError: /Users/[NAME]/[COMPANY]/dev/[APPNAME]/node_modules/react-native-scrollable-tab-view/index.js: ENOENT: no such file or directory, open '/Users/[NAME]/[COMPANY]/dev/[APPNAME]/node_modules/react-native-scrollable-tab-view/package.json' 2017-03-20 19:22:40.549905 [APPNAME][69099:5420846] [] nw_host_stats_add_src recv too small, received 24, expected 28 2017-03-20 19:22:40.523325 [APPNAME][69099:5420843] [] nw_host_stats_add_src recv 太小,收到 24,预计 28 2017-03-20 19:22:40.541Error [fatmain][] /Users/[NAME]/[COMPANY]/dev/[APPNAME]/node_modules/react-native-scrollable-tab-view/index.js:ENOENT:没有这样的文件或目录,打开'/Users/[NAME]/ [COMPANY]/dev/[APPNAME]/node_modules/react-native-scrollable-tab-view/package.json' 2017-03-20 19:22:40.549905 [APPNAME][69099:5420846] [] nw_host_stats_add_src re , 收到 24, 预计 28

Have tried the following to fix:已尝试以下修复:

rm -rf node_modules
rm -fr $TMPDIR/react-*
rm -fr $TMPDIR/npm*
watchman watch-del-all
rm -rf * (in /users/name/developer/xcode/deriveddata/
npm install
react-native upgrade

Also re-install react-native, react-native-cli还要重新安装 react-native、react-native-cli

Also updated node to newest version还将节点更新为最新版本

Also reinstalled xcode还重新安装了xcode

User Matt Aft pointed me in the right direction with a question around the packager.用户 Matt Aft 向我指出了正确的方向,并提出了有关打包程序的问题。 Here's the solution that was in a comment to his comment (for anyone suffering this problem and needing a solution):这是对他的评论的评论中的解决方案(对于任何遇到此问题并需要解决方案的人):

This put me on a good path.这让我走上了一条很好的道路。 Thanks Matt.谢谢马特。 Closing packager and re-running didn't do it, but clearing the packager cache showed a lot of conflicts between dependencies.关闭打包器重新运行并没有这样做,但是清除打包器缓存显示依赖项之间存在很多冲突。 Fixing those, clearing cache, reinstalling node_modules, clearing the xcode cache in ~/library/developer/xcode/deriveddata and /var/folders inhale fixed the immediate problem.. but now I have another issue that'll post in another ticket.修复这些,清除缓存,重新安装 node_modules,清除 ~/library/developer/xcode/deriveddata 和 /var/folders inhale 中的 xcode 缓存修复了眼前的问题..但现在我有另一个问题将发布在另一张票中。 Thanks again Matt!再次感谢马特! ——

The application is expecting a file at应用程序正在等待一个文件在

/Users/[NAME]/[COMPANY]/dev/[APPNAME]/node_modules/react-native-scrollable-tab-view/index.js /Users/[NAME]/[COMPANY]/dev/[APPNAME]/node_modules/react-native-scrollable-tab-view/index.js

but that file does not exist (which is what ENOENT means).但该文件不存在(这就是 ENOENT 的意思)。 So you either have to create the expected directory structure or else configure your application such that it looks in the correct directory.因此,您要么必须创建预期的目录结构,要么配置您的应用程序,使其在正确的目录中查找。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM