警告 包未定义已被忽略,因为它包含无效配置。原因:找不到模块 'undefined/package.json'

warn Package undefined has been ignored because it contains invalid configuration. Reason: Cannot find module 'undefined/package.json'

在我的 app.json 文件夹中,我已经很好地捆绑了所有东西,但我在安装列表的底部有一个未定义的包:

"undefined": "react-navigation/bottom-tabs"

我尝试了 运行 和 "npm install react-navigation/bottom-tabs" 但它抛出了这个错误:

warn Package undefined has been ignored because it contains invalid configuration. Reason: Cannot find module 'undefined/package.json'

有没有人遇到过这样的问题?我是 运行 React-Native Expo 之上的第 5 版。

编辑:原来它应该是@react-navigation/bottom-tabs,所以我安装了它并做了调整;但现在我仍然卡在 app.json 文件夹中的原始未定义包中,无法摆脱它。

So, I forgot this post existed and I actually figured this out months ago. When you're dealing with:

A bad bundle,

the wrong version,

or there's just something wrong with your 'app.json' file, (the file that contains the list of your packages)

These steps should fix it:

  1. Perform "npm uninstall 'package-name' " or "yarn remove 'package-name'"

Note: You do this instead of 'expo-uninstall' because 'expo-uninstall' does not exist. We use 'expo-install' instead of 'npm' or 'yarn' install to make sure you download the proper npm or yarn version associated with your version of expo.

  1. Open the app.json file and see if the bad package you uninstalled is still present.

  2. If the bad package is still there, select and delete it from the file, then save.

  3. 运行 an "expo" "npm" or "yarn" install on the correct package name

This should fix it. This is best fixed when step 4 is executed with an 'expo install' as you likely have an incompatible version of the package, so this will prevent that from happening again.

In my case, I couldn't figure out why my terminal was telling me a specific package didn't exist, so I did a "sud" command to force download the package. This package didn't exist, because I had actually spelled it wrong.