简体   繁体   English

启动 React Native 项目时出现莫名其妙的错误 - TypeError: undefined is not an object(评估 '_MaterialIcons.default.propTypes.style')

[英]Inexplicable Error When Starting React Native Project - TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style')

I was working in my project with no problem, the last thing I had installed was the react-native-video-player and all was working well.我在我的项目中工作没有问题,我安装的最后一件事是react-native-video-player ,一切运行良好。 I ran into a normal error, I think it was a typo I had just added, something simple, and it shut down the app, as expected.我遇到了一个正常的错误,我认为这是我刚刚添加的一个错字,很简单,它按预期关闭了应用程序。 I fixed the error and tried to start the project again, to be greeted with the following error, seen in the title...我修复了错误并尝试再次启动项目,但出现以下错误,如标题所示...

TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style')

I then tried the usual slew of things I try when something in a file that I have no access to is bugging.然后,当我无法访问的文件中的某些内容出现窃听时,我尝试了通常的一系列尝试。 I deleted node_modules and my package.lock.json and reran npm i.我删除node_modules和我的package.lock.json并重新运行npm i. I kept getting the same error, proceeded by a few different ones.我一直收到同样的错误,然后是几个不同的错误。 After trying numerous solutions, uninstalling different npm packages that I thought would be the culprit, and no success.在尝试了许多解决方案后,卸载了我认为是罪魁祸首的不同 npm 包,但没有成功。 The way I got the errors and any errors proceeding the initial one kept changing, but now I've hit a wall.我得到错误的方式以及发生最初错误的任何错误都在不断变化,但现在我碰壁了。 The phone simulator white screens, and I get the following three errors in my Metro Bundle Terminal:电话模拟器白屏,我在 Metro Bundle 终端中收到以下三个错误:

TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style')


 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.


 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

I then created a new branch where I deleted node_modules , package.lock.json , yarn.lock , and even my package.json . I then created a new branch where I deleted node_modules , package.lock.json , yarn.lock , and even my package.json . When I then tried to start the app using npx react-native run-is , I got the expected prompt to install React Native.然后,当我尝试使用npx react-native run-is启动应用程序时,我收到了安装 React Native 的预期提示。 I did, and it installed.我做了,它安装了。 Once it installed, I got the same error, If I run a search for the words involved with the error-- nothing.安装后,我得到了同样的错误,如果我搜索与错误有关的单词 - 什么都没有。 if I try to search for the page in which the error occurs-- nothing.如果我尝试搜索发生错误的页面 - 什么都没有。 So this means it HAS to be in the node_modules , as those are the only files where searches don't hit.所以这意味着它必须在node_modules中,因为这些是唯一没有被搜索到的文件。 I truly have no idea how to solve this, as I haven't used material icons anywhere (including my yarn.lock , my package.json , and my package.lock.json ) I truly have no idea how to solve this, as I haven't used material icons anywhere (including my yarn.lock , my package.json , and my package.lock.json )

To summarize the steps I've tried to no avail (in no order, I don't remember anymore)...总结一下我尝试无济于事的步骤(没有顺序,我不记得了)......

  1. deleted node_modules , package.lock.json and yarn.lock and ran npm i and yarn删除node_modulespackage.lock.jsonyarn.lock并运行npm iyarn
  2. deleted ios/pods and ios/build and ios/Podfile.lock and ran pod install删除ios/podsios/buildios/Podfile.lock并运行pod install
  3. ran pod update运行pod update
  4. Some combination of 1, and 2 1和2的某种组合
  5. run npm uninstall material-icons运行npm uninstall material-icons
  6. Deleted all node related, and yarn related files and directories and started fresh with a brand new react-native install删除了所有与节点相关和纱线相关的文件和目录,并使用全新的 react-native 安装重新开始
  7. run yarn cache clean运行yarn cache clean
  8. run killall -9 node运行 killall -9 节点
  9. run npm audit -fix运行npm audit -fix
  10. Restarted my machine重新启动我的机器

I should have tried this earlier, but it ended up being something messed up in the react-native-video-player .我应该早点尝试这个,但它最终在react-native-video-player中搞砸了。 They had to have added something to it very recently, as I was successfully using it awhile ago.他们必须最近添加了一些东西,因为我不久前成功使用了它。 Gotta love when they up upload deprecated packages当他们上传已弃用的软件包时一定会喜欢

暂无
暂无

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

相关问题 错误 PropTypes React Native undefined is not an object(评估'_propTypes.default.nymber.isRequired') - Error PropTypes React Native undefined is not an object (evaluating '_propTypes.default.nymber.isRequired') React Native TypeError: undefined is not an object (evalating '_reactNative.Animated.Text.propTypes.style') 在 iOS 模拟器 - React Native TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style') in iOS simulator React Native AdMob 错误:undefined 不是对象(评估“_reactNative.View.propTypes.style”) - React Native AdMob Error: undefined is not an object (evaluating '_reactNative.View.propTypes.style') react-native-in-app-notification 错误类型错误:未定义不是 object(评估“_reactNative.Image.propTypes.source”) - react-native-in-app-notification ERROR TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.source') “TypeError: undefined is not an object (evalating '_react.PropTypes.array')” 在 Mac 上反应原生 - "TypeError: undefined is not an object (evaluating '_react.PropTypes.array')" React native on Mac TypeError: undefined is not an object(评估'_reactNative.Animated.Text.propTypes.style') - TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style') React-Native-未定义不是对象(“评估_react3.default.PropTypes.shape”) - React-Native – undefined is not an object (“evaluating _react3.default.PropTypes.shape”) TypeError:未定义不是对象(评估style.width)是本机反应 - TypeError: undefined is not an object (evaluating style.width) react native React-Native - undefined 不是一个对象(“评估 _react3.default.PropTypes.shape”) - React-Native - undefined is not an object (“evaluating _react3.default.PropTypes.shape”) undefined 不是一个对象(评估'_react.proptypes.shape')-React Native - undefined is not an object (evaluating '_react.proptypes.shape') - React Native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM