尝试在android上构建带有react-navigation的react-native v0.61.5应用程序时遇到此错误。iOS运行良好,不知道为什么我会得到这个index.android文件错误,因为我认为react-native将索引文件合并到singular < code > index . js 作为入口点。
这是全部错误:
加载依赖图,完成。错误:无法解析模块<代码>。``中的/index.android:
这些文件都不存在:* index.android(。native|.android.js|.native.js|。js|.android.json|.native.json|。json|.android.ts|.native.ts|。ts|.android.tsx|.native.tsx|。tsx) * index.android/index(。native|.android.js|.native.js|。js|.android.json|.native.json|。json|.android.ts|.native.ts|。ts|.android.tsx|.native.tsx|。tsx)在module resolver . resolve dependency(/Users/name/Desktop/Development/app/node _ modules/metro/src/node-haste/dependency graph/module resolution . js:163:15)在resolution request . resolve dependency(/Users/name/Desktop/Development/app/node _ modules/metro/src/node-haste/dependency graph/resolution request . js:52:18)在dependency graph . resolve dependency(/Users/name/Desktop/Development/app/node _ modules/metro/src/server . js:1088:41)at generator . next()at asynccgeneratorstep(/Users/name/Desktop/Development/app/node _ modules/metro/src/server . js:99:24)at _ next(/Users/name/Desktop/Development/app/node _ modules/metro/src/server . js:119:9)
以下是index.js:
import { AppRegistry } from 'react-native';
import App from './App';
import 'react-native-gesture-handler';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => App);
package.json:
{
"name": "appName",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"algoliasearch": "^4.0.3",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"react": "16.9.0",
"react-instantsearch-native": "^6.3.0",
"react-native": "0.61.5",
"react-native-agora": "^2.9.1-alpha.2",
"react-native-algolia-dropdown": "^1.6.0",
"react-native-calendars": "^1.220.0",
"react-native-chart-kit": "^4.3.0",
"react-native-code-push": "^6.0.0",
"react-native-extended-stylesheet": "^0.12.0",
"react-native-firebase": "^5.6.0",
"react-native-gesture-handler": "^1.5.2",
"react-native-image-crop-picker": "^0.26.1",
"react-native-material-dropdown": "^0.11.1",
"react-native-reanimated": "^1.4.0",
"react-native-safe-area-context": "^0.6.2",
"react-native-screens": "^1.0.0-alpha.23",
"react-native-snap-carousel": "^3.8.4",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^9.13.6",
"react-native-view-shot": "^3.1.2",
"react-navigation": "^4.0.10",
"react-navigation-drawer": "^2.3.3",
"react-navigation-stack": "^1.10.3",
"react-redux": "^7.1.3",
"redux": "^4.0.4",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.11.2",
"tipsi-stripe": "^7.5.1"
},
"devDependencies": {
"@babel/core": "7.7.5",
"@babel/runtime": "7.7.6",
"@react-native-community/eslint-config": "0.0.5",
"babel-jest": "24.9.0",
"eslint": "6.7.2",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.56.3",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
图书馆整合得当,有什么建议吗?
这对我来说已经解决了
react-native link
使用缓存清理运行打包程序:npx react-native start --reset-cache
这是抛出错误因为它无法找到index.android文件在您的根目录的项目如果您有index.ios在您的项目
您可以创建index.android.js文件并在该导入原始index.js文件中检查它是否有效(快速修复)
因此,基本上在React v0.49之后,您不需要index.ios。js和index.android.js。您只需要index.js:
但当这个问题出现时,有两种情况
第一种情况的解决方案
//For android in this directory you need to make this change android/app/src/main/java/<yourPackage>/MainApplication.java
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
//...
@Override
protected String getJSMainModuleName() {
return "index";
}
};
//对于此目录中的ios,为ios//AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
//...
}
这两种解决方案在某些情况下也有效
或
在某些情况下,因此很难确定为什么有人会遇到此问题。
问题内容: 我正在使用Babel和Webpack开发一个React应用,我想使用npm中的软件包。我已经安装了该软件包并将其保存为项目的依赖项。运行npm start后,出现此错误: ./~/file-exists/index.js中的错误找不到 模块:错误:无法在C:\ GitHub \ CryptoPrices \ node_modules \ file-exists @ ./~/file-e
我正在使用Redux尝试我的第一个react-native应用程序,并在设备上运行应用程序时得到以下错误消息, “UnableToResolveError:无法从C:\project\testing\index.android.js解析模块react-redux/native:模块映射或以下目录中不存在模块:C:\project\testing\node_modules\react-redux”
我正在尝试创建一个JupyterLab扩展,它使用typescript。 我已经成功地添加了包“@类型/节点”,允许我使用诸如“要求”(“超文本传输协议”)这样的包。 但一旦我尝试使用子进程,使用“require”(“child_process”),我在尝试构建扩展时就会出现以下错误。 我在谷歌上搜索过,但仍然不知道如何解决这个问题。 如有任何提示或信息,将不胜感激。 我的包裹。json文件。
问题内容: 我正在将样式加载器与webpack和react框架一起使用。当我在终端中运行webpack时,尽管我已正确指定了文件路径,但我仍获取import.js文件。 webpack.config.js: 问题答案: 尝试在下面运行脚本: 修改webpack配置,在中添加字段。
当我执行npm运行构建时,我得到以下错误 找不到./src/assets/scss/theme.scss(./node_modules/css-loader/dist/cjs.js!./node_modules/resolve-url-loader!./node_modules/sass-loader/dist/cjs.js!./src/assets/scss/theme.scss)模块:错误:无
我正在用JDK11和Eclipse 2020-06开发一个RCP应用程序。我有一个基于功能的产品文件。当我发布产品时,我得到了如下错误。我听说JDK 11不包含JAXB。这个错误与此有关吗?我正在努力寻找解决办法。。谢谢你的帮助。谢谢 !ENTRYorg.eclipse.mylyn.commons.notifications.feed4 0 2021-02-08 18:15:45.088!消息框架