meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.37k stars 2.29k forks source link

Cannot run example on android: Unable to resolve module `react-native-snap-carousel` #679

Open kopax opened 4 years ago

kopax commented 4 years ago

Is this a bug report, a feature request, or a question?

Question

Have you followed the required steps before opening a bug report?

Have you made sure that it wasn't a React Native bug?

yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Android

Is the bug reproductible in a production environment (not a debug one)?

In an emulator, I didn't went that far to tell it's production

Environment

Emulator

Expected Behavior

I expect to run the examples on android

Actual Behavior

Right after cloning the master branch, running npm run android produce the following

dka@dka:[~/workspace/github.com/archriss/react-native-snap-carousel/example (master)]: npm run start

> example@0.61.5 start /home/dka/workspace/github.com/archriss/react-native-snap-carousel/example
> react-native start

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  Running Metro Bundler on port 8081.                                         │
│                                                                              │
│  Keep Metro running while developing on any JS projects. Feel free to        │
│  close this tab and run your own Metro instance if you prefer.               │
│                                                                              │
│  https://github.com/facebook/react-native                                    │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
   /home/dka/workspace/github.com/archriss/react-native-snap-carousel/example 

Loading dependency graph, done.

To reload the app press "r"
To open developer menu press "d"

info Reloading app...
error: bundling failed: Error: Unable to resolve module `react-native-snap-carousel` from `src/index.js`: react-native-snap-carousel could not be found within the project.

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 (/home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
    at ResolutionRequest.resolveDependency (/home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
    at Object.resolve (/home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/lib/transformHelpers.js:267:42)
    at /home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31
    at Array.map (<anonymous>)
    at resolveDependencies (/home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
    at /home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/home/dka/workspace/github.com/archriss/react-native-snap-carousel/example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
 BUNDLE  [android, dev] ./index.js ▓▓░░░░░░░░░░░░░░ 16.0% (2/94)::ffff:127.0.0.1 - - [07/Apr/2020:17:23:51 +0000] "GET /index.bundle?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"
 BUNDLE  [android, dev] ./index.js ▓▓░░░░░░░░░░░░░░ 16.0% (2/94), failed.

image

Reproducible Demo

The examples directory of this repository

Steps to Reproduce

git clone https://github.com/archriss/react-native-snap-carousel.git
cd react-native-snap-carousel
npm i
cd example
npm i
npm run start
# press r
superqianqian commented 4 years ago

add react-native-snap-carousel

gie3d commented 4 years ago

It seems to work with yarn instead of npm (I can reproduce the issue with npm). Don't know the reason yet

git clone https://github.com/archriss/react-native-snap-carousel.git
cd react-native-snap-carousel
yarn
cd example
yarn
yarn android

I tried to change the example's package.json on "react-native-snap-carousel": "file:../" to "react-native-snap-carousel": "3.9.0" in this cae, it can work with npm install and npm run android. So I think it might relate to the local package and npm.

prashantbasnet94 commented 3 years ago

any solution with npm yet?

crastyle commented 3 years ago

yarn add react-native-snap-carousel @types/react-native-snap-carousel

two packages, both

dohooo commented 3 years ago

Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2

mamonaabdullah122 commented 2 years ago

I have the same issue can someone helppppp

crastyle commented 2 years ago

您好,以下是自动回复内容:  您的来信我已收到,我会在尽快最短时间内回复您!  谢谢您的来信,祝您生活愉快

mamonaabdullah122 commented 2 years ago

Thanks

mamonaabdullah122 commented 2 years ago

TypeError: Cannot read properties of undefined (reading 'hookChildProcess') in react native:

Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. error Failed to run jetifier. TypeError: Cannot read properties of undefined (reading 'hookChildProcess') at module.exports (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/react-native/node_modules/execa/index.js:308:22) at Object.runAndroid [as func] (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/react-native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:104:34) at Command.handleAction (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/@react-native-community/cli/build/index.js:192:23) at Command.listener (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/commander/index.js:315:8) at Command.emit (node:events:527:28) at Command.parseArgs (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/commander/index.js:651:12) at Command.parse (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/commander/index.js:474:21) at setupAndRun (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/@react-native-community/cli/build/index.js:271:24) at run (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/@react-native-community/cli/build/index.js:212:11) at Object. (/Volumes/Os/ReactNativePROJECT/Educational/node_modules/@react-native-community/cli/build/bin.js:8:11) info Run CLI with --verbose flag for more details.

StanislavMayorov commented 2 years ago

I managed to run the example on android:

crastyle commented 2 years ago

您好,以下是自动回复内容:  您的来信我已收到,我会在尽快最短时间内回复您!  谢谢您的来信,祝您生活愉快

syeddastagir1 commented 1 year ago

yarn add react-native-snap-carousel @types/react-native-snap-carousel

two packages, both

Its work for me thanks for your help.