Node.js 不变违例:";“主要”;尚未注册。如果:*Metro(本地开发服务器)从错误的文件夹运行,则可能发生这种情况
我已将我的index.js更改为此,因为我正在尝试遵循以下步骤:Node.js 不变违例:";“主要”;尚未注册。如果:*Metro(本地开发服务器)从错误的文件夹运行,则可能发生这种情况,node.js,react-native,redux,react-redux,Node.js,React Native,Redux,React Redux,我已将我的index.js更改为此,因为我正在尝试遵循以下步骤: https://www.youtube.com/watch?v=6soHPnHxHxI import { registerRootComponent } from 'expo'; import React from "react"; import { AppRegistry } from "react-native"; im
https://www.youtube.com/watch?v=6soHPnHxHxI
import { registerRootComponent } from 'expo';
import React from "react";
import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";
import { Provider } from "react-redux";
import { Provider as PaperProvider } from "react-native-paper"
import store from "./store";
import 'react-native-gesture-handler';
const AppRedux = () => {
<Provider {...{store}}>
<PaperProvider>
<App></App>
</PaperProvider>
</Provider>
}
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in the Expo client or in a native build,
// the environment is set up appropriately
//AppRegistry.registerComponent(appName, () => AppRedux);
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in the Expo client or in a native build,
// the environment is set up appropriately
registerRootComponent(AppRedux);
您是否从正确的文件夹运行了
expo start
或npm start
?@RagulCs,npm从正确的文件夹启动,我使用可视源代码并从package.json文件运行应用程序,但它是从正确的文件夹运行的,即根项目文件夹请参阅此
Invariant Violation: "main" has not been registered. This can happen if: * Metro (the local dev server) is run from the wrong folder.