[英]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)...总结一下我尝试无济于事的步骤(没有顺序,我不记得了)......
node_modules
, package.lock.json
and yarn.lock
and ran npm i
and yarn
删除node_modules
, package.lock.json
和yarn.lock
并运行npm i
和yarn
ios/pods
and ios/build
and ios/Podfile.lock
and ran pod install
删除ios/pods
和ios/build
和ios/Podfile.lock
并运行pod install
pod update
运行pod update
npm uninstall material-icons
运行npm uninstall material-icons
yarn cache clean
运行yarn cache clean
npm audit -fix
运行npm audit -fix
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.