RoJoHub / react-native-ping

Highly accurate ICMP Ping controller for React Native
https://www.npmjs.com/package/react-native-ping
61 stars 46 forks source link

Incompatible with react-native version 0.73.6 #117

Open sepsol opened 6 months ago

sepsol commented 6 months ago
$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-native-ping@1.2.8
npm ERR! Found: react-native@0.73.6
npm ERR! node_modules/react-native
npm ERR!   react-native@"0.73.6" from the root project
npm ERR!   peer react-native@"*" from @gorhom/bottom-sheet@4.6.1
npm ERR!   node_modules/@gorhom/bottom-sheet
npm ERR!     @gorhom/bottom-sheet@"^4.6.1" from the root project
npm ERR!   40 more (@gorhom/portal, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.41.2 || ^0.57.0 || ^0.68.0 || ^0.70.0" from react-native-ping@1.2.8
npm ERR! node_modules/react-native-ping
npm ERR!   react-native-ping@"^1.2.8" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react-native@0.70.15
npm ERR! node_modules/react-native
npm ERR!   peer react-native@"^0.41.2 || ^0.57.0 || ^0.68.0 || ^0.70.0" from react-native-ping@1.2.8
npm ERR!   node_modules/react-native-ping
npm ERR!     react-native-ping@"^1.2.8" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/username/.npm/_logs/2024-03-25T20_10_19_693Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/username/.npm/_logs/2024-03-25T20_10_19_693Z-debug-0.log
marceloch2 commented 4 months ago

I'm using with "react-native": "0.73.7" @sepsol, and "react-native-ping": "^1.2.8".

NhatAnh commented 2 months ago

@marceloch2 I just try to install it today but I got

npm ERR! Found: react-native@0.73.6
npm ERR! node_modules/react-native
npm ERR!   react-native@"0.73.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.41.2 || ^0.57.0 || ^0.68.0 || ^0.70.0" from react-native-ping@1.2.8

Did you install with --force or --legacy-peer-deps?

dasilvaca commented 2 months ago

@marceloch2 I just try to install it today but I got

npm ERR! Found: react-native@0.73.6
npm ERR! node_modules/react-native
npm ERR!   react-native@"0.73.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.41.2 || ^0.57.0 || ^0.68.0 || ^0.70.0" from react-native-ping@1.2.8

Did you install with --force or --legacy-peer-deps?

As it certainly do the job... Doesn't this mean this restrictions are not totally true? I mean. at 0.71.5 this module works just fine. The only thing I did was... Copying the index.d.ts onto my types one as this:

declare module 'react-native-ping' {
    type PingOptions = {
        /** Amount of time in ms to wait before reporting ping failed (Default: 1000ms) */
        timeout?: number;
        /** [iOS only] Size of the payload to send to the server (Default: 56 bytes) */
        payloadSize?: number;
      };

      type TrafficStats = {
        receivedNetworkSpeed: string;
        receivedNetworkTotal: string;
        sendNetworkSpeed: string;
        sendNetworkTotal: string;
      };

      export default class Ping {
        /**
         * Ping a specified server and return the RTT (Round-trip time) in ms
         * 
         * @param ipAddress IP Address of the server to ping (eg: 8.8.8.8)
         * @param options   Optional parameters
         */
        static start(
          ipAddress: string,
          options?: PingOptions,
        ): Promise<number>;

        static getTrafficStats(): Promise<TrafficStats>;
      }
}

So, then, if all the job is done... Why don't just increase the versions the module is available at? And, if it certainly works on typescript, why don't make it available to do so?

marceloch2 commented 2 months ago

--legacy-peer-deps

No --legacy-peer-deps or --force ish added my side. But I'm using yarn, can you try with it?

dasilvaca commented 2 months ago

--legacy-peer-deps

No --legacy-peer-deps or --force ish added my side. But I'm using yarn, can you try with it?

I see the issue...

image

This seems to be the code available at npm. Different from the one at master which is:

(...)
"peerDependencies": {
    "react-native": ">=0.41.2"
  }

Then, this must be fixed as simple as merge package.json into the npm available one

hasithaWalpola commented 1 month ago

@RoJoHub can you please update the NPM package with new PRs