NathanaelA / nativescript-websockets

Websockets for NativeScript
83 stars 43 forks source link

Module not found: Error: Can't resolve 'nativescript-websockets' in 'C:\Users\g\Documents\cliApp\src\app\home' #73

Closed baptistapedro closed 4 years ago

baptistapedro commented 4 years ago

I'm not sure why it cant resolve the plugin, I have it installed properly of course.

https://dpaste.de/4C8f

NathanaelA commented 4 years ago

Did you double check that it is in the package.json file as a dependancy. And that it is in the node_modules folder?

baptistapedro commented 4 years ago

Yes, it is present on both.

baptistapedro commented 4 years ago

Do I have to downgrade the version of something on my project? Because if I remove the declare var require: any;

I have this issue:

ERROR in ./src/app/home/home.component.ts
Module not found: Error: Can't resolve 'nativescript-websockets' in 'C:\Users\gitim\Documents\cliApp\src\app\home'
i 「wdm」: Failed to compile.

    ERROR in src/app/home/home.component.ts(4,1): error TS2591: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.

Even with the installation of @types/node and also add the node on my tsconfig

This is my version: @types/node@8.10.54

baptistapedro commented 4 years ago

My project was created using this command ng new --collection=@nativescript/schematics --name=my-app --shared

I believe if you do the same and try to use the websockets plugin, you'll run through the same issue.

baptistapedro commented 4 years ago

Seems like your plugin does not work on web, only Android and iOS

NathanaelA commented 4 years ago

Correct, this plugins is only for Android / iOS. Web already has a built in websocket; so you don't need my library for it. :grinning:

thepraveenkumar commented 4 years ago

You can use pusher-nativescript npm module.

import { Pusher } from 'pusher-nativescript'; /*Observation using the above.

NathanaelA commented 4 years ago

@thepraveenkumar - I'm not sure if you are trying to report a bug; or suggest he uses pusher... If it is a bug, then you need to report this issue on whatever repo is for pusher-nativescript.