danielzzz / node-ping

a poor man's ping library (using udp scanning) for node
MIT License
332 stars 105 forks source link

Getting message: "ping__WEBPACK_IMPORTED_MODULE_1__ is not defined" stack: "ReferenceError: ping__WEBPACK_IMPORTED_MODULE_1__ is not defined↵ at eval (eval at step #127

Closed debjava closed 4 years ago

debjava commented 4 years ago

I am using Typescript along with Angular, Electron and NodeJs 10. While using this library "ping": "^0.2.3", "@types/ping":"^0.2.0" , I am getting below the error, please help me.

message: "pingWEBPACK_IMPORTED_MODULE_1 is not defined" stack: "ReferenceError: pingWEBPACK_IMPORTED_MODULE_1 is not defined↵ at eval (eval at step

I provide below the code.

import {promise} from "ping";
private async getLatency(hostOrIp: string): Promise<number> {
        const result = await promise.probe(hostOrIp);
        const latency = result.avg;
        return (latency !== "unknown") ? Math.floor(parseFloat(latency)) : -1;
    }

Please help me as I am struck now.

mondwan commented 4 years ago

This library will use system ping for processing. It cannot run on browser. Are u running that on browser?

在 2020年9月11日週五 19:00,Debadatta Mishra notifications@github.com 寫道:

I am using Typescript along with Angular, Electron and NodeJs 10. While using this library "ping": "^0.2.3", "@types/ping":"^0.2.0" , I am getting below the error, please help me.

message: "pingWEBPACK_IMPORTED_MODULE_1 is not defined" stack: "ReferenceError: pingWEBPACK_IMPORTED_MODULE_1 is not defined↵ at eval (eval at step

I provide below the code.

import {promise} from "ping";

private async getLatency(hostOrIp: string): Promise {

    const result = await promise.probe(hostOrIp);

    const latency = result.avg;

    return (latency !== "unknown") ? Math.floor(parseFloat(latency)) : -1;

}

Please help me as I am struck now.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danielzzz/node-ping/issues/127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YBI3OF3F3CGZOU4HRZJTSFH7N3ANCNFSM4RHG3BIA .

debjava commented 4 years ago

Thanks for your support. I have resolved it.

debjava commented 4 years ago

This library will use system ping for processing. It cannot run on browser. Are u running that on browser? 在 2020年9月11日週五 19:00,Debadatta Mishra notifications@github.com 寫道: I am using Typescript along with Angular, Electron and NodeJs 10. While using this library *"ping": "^0.2.3", @.**/ping":"^0.2.0" , I am getting below the error, please help me. message: "pingWEBPACK_IMPORTED_MODULE_1 is not defined" stack: "ReferenceError: pingWEBPACK_IMPORTED_MODULE_1 is not defined↵ at eval (eval at step I provide below the code. import {promise} from "ping"; private async getLatency(hostOrIp: string): Promise { const result = await promise.probe(hostOrIp); const latency = result.avg; return (latency !== "unknown") ? Math.floor(parseFloat(latency)) : -1; } Please help me as I am struck now. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#127>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YBI3OF3F3CGZOU4HRZJTSFH7N3ANCNFSM4RHG3BIA .

Yes, I am running from chrome browser. It looks like is not possible from browser. Could you please confirm me.

mondwan commented 4 years ago

Yes. You cannot run this library on browser environment.

Hopefully, you may need something like http ping. But, they are irrelevant to our library.

在 2020年9月17日週四 23:10,Debadatta Mishra notifications@github.com 寫道:

This library will use system ping for processing. It cannot run on browser. Are u running that on browser? 在 2020年9月11日週五 19:00,Debadatta Mishra notifications@github.com 寫道: … <#m-6780142424981574434> I am using Typescript along with Angular, Electron and NodeJs 10. While using this library *"ping": "^0.2.3", @.**/ping":"^0.2.0" , I am getting below the error, please help me. message: "pingWEBPACK_IMPORTED_MODULE_1 is not defined" stack: "ReferenceError: pingWEBPACK_IMPORTED_MODULE_1 is not defined↵ at eval (eval at step I provide below the code. import {promise} from "ping"; private async getLatency(hostOrIp: string): Promise { const result = await promise.probe(hostOrIp); const latency = result.avg; return (latency !== "unknown") ? Math.floor(parseFloat(latency)) : -1; } Please help me as I am struck now. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#127 https://github.com/danielzzz/node-ping/issues/127>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YBI3OF3F3CGZOU4HRZJTSFH7N3ANCNFSM4RHG3BIA .

Yes, I am running from chrome browser. It looks like is not possible from browser. Could you please confirm me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danielzzz/node-ping/issues/127#issuecomment-694301566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YBI6SKXE74U644E7VQL3SGIREVANCNFSM4RHG3BIA .