Linked Questions

Popular Questions

import Swiper show error by using react-native-swiper

Asked by At

I try to use swiper from this library https://github.com/leecade/react-native-swiper

Here is my dependencies:

"react": 16.3.1,
"react-native": "~0.55.2",
"react-native-swiper": "^1.5.13"

But when i just add this code import Swiper from 'react-native-swiper';

My component like:

import React, { Component } from 'react';
import { View, Text } from 'react-native';
import Swiper from 'react-native-swiper';

class Welcome extends Component {
  render() {
    return (
      <View>
        <Text>Welcome</Text>
      </View>
    );
  }
}

export default Welcome;

It will shows error even i don't use the <Swiper />

error:

Failed to load bundle

enter image description here

Check my terminal error shows:

error: bundling failed: Error: While trying to resolve module `react-native-swiper` from file `/Users/huaweb/ReactNativeProject/Huaweb/src/components/Welcome.js`, the package `/Users/huaweb/ReactNativeProject/Huaweb/node_modules/react-native-swiper/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/huaweb/ReactNativeProject/Huaweb/node_modules/react-native-swiper/index.js`. Indeed, none of these files exist:

I don't know what is However, this package itself specifies amainmodule field that could not be resolved

I can't figure it out. Is any thing i miss it ?

Any help would be appreciated, thanks in advance.

Related Questions