根据官网的yarn安装
yarn add react-native-router-flux
然后就出现了一些警告的问题,这些问题还不能忽略,负责在编译的yarn react-native start
的时候会报错,根本没办法去使用这个插件,有哪位大佬遇见这种问题吗?
<!--在安装这个插件的时候出现的警告-->
info fsevents@1.2.11: The platform "win32" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >=
3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning "react-native-router-flux > react-navigation-drawer@2.3.4" has unmet peer dependency "react-native-gesture-handler@^1.0.12".
warning "react-native-router-flux > react-navigation-drawer@2.3.4" has unmet peer dependency "react-native-reanimated@^1.0.0".
warning "react-native-router-flux > react-navigation-drawer@2.3.4" has unmet peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-native-router-flux > react-navigation-stack@1.10.3" has unmet peer dependency "react-native-gesture-handler@^1.0.0".
warning "react-native-router-flux > react-navigation-stack@1.10.3" has unmet peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-native-router-flux > react-navigation-tabs@2.7.0" has unmet peer dependency "react-native-gesture-handler@^1.0.0".
warning "react-native-router-flux > react-navigation-tabs@2.7.0" has unmet peer dependency "react-native-reanimated@^1.0.0-alpha".
warning "react-native-router-flux > react-navigation-tabs@2.7.0" has unmet peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-native-router-flux > react-navigation > @react-navigation/native@3.6.5" has unmet peer dependency "react-native-gesture-handler@*".
warning "react-native-router-flux > react-navigation-tabs > react-native-tab-view@2.13.0" has unmet peer dependency "react-native-gesture-handler@*".
warning "react-native-router-flux > react-navigation-tabs > react-native-tab-view@2.13.0" has unmet peer dependency "react-native-reanimated@*".
//react的代码 index.js
import {AppRegistry} from 'react-native';
import Main from './router';
// import App from './App'
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => Main);
//router.js
import React, { Component } from 'react';
import { Text, View } from 'react-native';
import { Router, Scene, Stack } from "react-native-router-flux"
//组件
import Login from "./views/login"
export default class Main extends Component {
render() {
const template = () => (
<Router>
<Stack key="root">
<Scene key="login" component={Login} title="登录"></Scene>
</Stack>
</Router>
)
return template
}
}
<!--报错信息-->
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (E:\myTest\paymulapp\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (E:\myTest\paymulapp\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (E:\myTest\paymulapp\node_modules\metro\src\node-haste\DependencyGraph.js:282:16)
at Object.resolve (E:\myTest\paymulapp\node_modules\metro\src\lib\transformHelpers.js:267:42)
at E:\myTest\paymulapp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:426:31
at Array.map (<anonymous>)
at resolveDependencies (E:\myTest\paymulapp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:423:18)
at E:\myTest\paymulapp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (E:\myTest\paymulapp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ 93.6% (489/571), failed.